API reference
Design
addAudioTrackaddElementAtCursoraddElementAtPointaddNativeElementaddPagecreateRichtextRangeeditContentgetCurrentPageContextgetDefaultPageDimensionsgetDesignMetadatagetDesignTokeninitAppElementopenDesignoverlay.registerOnCanOpenrequestExportselection.registerOnChangesetCurrentPageBackgroundui.startDragToCursorui.startDragToPointui.startDrag
Intents: data
Intents: design
Platform
appProcessappProcess.broadcastMessageappProcess.currentappProcess.current.getInfoappProcess.current.requestCloseappProcess.current.setOnDisposeappProcess.requestCloseappProcess.registerOnMessageappProcess.registerOnStateChangefeatures.isSupportedfeatures.registerOnSupportChangegetPlatformInfonotification.addToastrequestOpenExternalUrl
requestFontSelection
API reference for the requestFontSelection method.
Opens a font picker.
Usage
Open a font picker
import { requestFontSelection } from "@canva/asset";const response = await requestFontSelection();
TYPESCRIPT
Open a font picker with a preselected font
import { type FontRef, requestFontSelection } from "@canva/asset";const placeholderFontRef = "PLACEHOLDER_FONT_REF" as FontRef;const response = await requestFontSelection({selectedFontRef: placeholderFontRef});
TYPESCRIPT
Handle font selection response
import { requestFontSelection } from "@canva/asset";const response = await requestFontSelection();if (response.type === "completed") {const { ref, name, weights } = response.font;} else {// Handle selection cancelled if needed}
TYPESCRIPT
Parameters
requestFontSelectionRequestOptional
Options for configuring a font picker.
selectedFontRefFontRefOptional
The ref of a font to display as selected when the font picker is opened.
Returns
The result of selecting a font from a font picker. This is a Promise that resolves with the following object:
typestringThe type of result.
The only valid value is "completed".
fontFontThe selected font.
refFontRefA unique identifier that points to a font asset in Canva's backend.
namestringThe name of the font.
weightsFontWeight[]The available font weights for the font.
weightFontWeightNameThe name of the font weight.
Available values:
"normal""thin""extralight""light""medium""semibold""bold""ultrabold""heavy"
stylesFontStyle[]The font styles available for this specific font weight.
Available values:
"normal""italic"
previewUrlstringOptional
The URL of an image that renders a preview of the font.
typestringThe type of result.
The only valid value is "aborted".