Custom Font List

Font structure definition

A font is described by the IFontConfig interface:

PropertyTypeDescription
valuestringThe unique identifier of the font, usually the value to use for CSS font-family.
labelstringThe translation key used for internationalization. If the key is not specified when the Univer instance is created, the supplied value is displayed directly.
categoryFontCategoryFont category, used to group entries in the UI. Optional.

Univer does not prevent users from selecting a font that is not installed. If the client does not have that font, the browser falls back to the default font.

Using custom fonts

Configure customFontFamily on UniverSheetsCorePreset (Preset Mode) or UniverUIPlugin (Plugin Mode) to set the choices in the font dropdown.

Plugin configuration

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 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: 'PingFang SC',        label: '苹方(简)',        category: FontCategory.SANS_SERIF,      },      {        value: 'Helvetica Neue',        label: 'Helvetica Neue',        category: FontCategory.SANS_SERIF,      },    ],    // Whether to override the default font list, defaults to false    override: true,  },})

Preset configuration

UniverSheetsCorePreset

  • container
    string | HTMLElementDefault: 'app'
    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 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 } from '@univerjs/ui'const { univerAPI } = createUniver({  presets: [    UniverSheetsCorePreset({      container: 'app',      customFontFamily: {        list: [          {            value: 'PingFang SC',            label: '苹方(简)',            category: FontCategory.SANS_SERIF,          },          {            value: 'Helvetica Neue',            label: 'Helvetica Neue',            category: FontCategory.SANS_SERIF,          },        ],        // Whether to override the default font list, defaults to false        override: true,      },    }),  ],})

Facade API

Fonts do not have to be configured at startup. They can also be added at runtime through the Facade API, which is useful when font files load asynchronously.

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

How is this guide?

© 2026 DreamNum Co., Ltd.