Custom Font List

The Slides text editor uses Univer’s shared font list for its font-family dropdown. That list belongs to the application, and you configure it on UniverUIPlugin.

Configure font choices

UniverUIPlugin

  • container
    string | HTMLElement
    Element to mount into, or its DOM ID.
  • customFontFamily
    IFontConfig[] | object
    Adds these font choices to the dropdown.
    • list
      IFontConfig[]
      Adds these font choices to the dropdown.
      • value
        string
        Font family name used in CSS.
      • label
        string
        Display name, or a translation key.
      • category
        FontCategory
        Font group. Use sans-serif, serif, monospace, display, or handwriting.
    • override
      booleanDefault: false
      Replaces the built-in choices with the supplied list.
TypeScript
import { FontCategory, UniverUIPlugin } from '@univerjs/ui'univer.registerPlugin(UniverUIPlugin, {  container: 'app',  customFontFamily: {    list: [      {        value: 'Inter',        label: 'Inter',        category: FontCategory.SANS_SERIF,      },      {        value: 'Noto Serif',        label: 'Noto Serif',        category: FontCategory.SERIF,      },    ],    override: false,  },})

value is written as the text run’s font family. label is the text that the dropdown displays, or an i18n key. category is optional and groups the choice.

Each font must be loaded with @font-face or a stylesheet. Adding a name to the list does not download a font file. If the family is unavailable, the browser uses a fallback.

Facade API

After the UI Facade has loaded, call addFonts to append font choices at runtime:

TypeScript
import { FontCategory } from '@univerjs/ui'univerAPI.addFonts([  {    value: 'Inter',    label: 'Inter',    category: FontCategory.SANS_SERIF,  },])

The dropdown updates immediately, but the corresponding font bytes are not loaded.

How is this guide?

© 2026 DreamNum Co., Ltd.