selectFont()

Opens a font picker panel in the editor, prompting the user to select a font. This function is intended for use in the settings panel of a site widget or plugin implemented with a custom element.

Syntax

Copy

Parameters

NameTypeDescription
valueFontPickerValueOptional. Value of the associated font and text-decoration CSS shorthand properties.
optionsSelectFontOptionsOptional. Options to use when opening the font picker panel.

FontPickerValue object

Copy
NameTypeDescription
fontstringValue of the associated font CSS shorthand property, which can include the following:
  • Font family
  • Font size
  • Font weight
  • Font style. Supports italic only.
textDecorationstringOptional. Value of the associated text-decoration CSS shorthand property. Can also be undefined.

SelectFontOptions object

Copy
NameTypeDescription
onChangeFunctionOptional. Callback function invoked when the font selection changes. It receives the updated FontPickerValue as a parameter.

Returns

Promise<FontPickerValue>

The font selected by the user.

Example

Copy
Did this help?