Returns a list of recommended fonts. The recommendations are based on a number of factors, such as the user's locale. To learn more, see Creating text.
Usage
Basic usage
import { findFonts } from "@canva/asset";const { fonts } = await findFonts();console.log(fonts); // => [ { name: "Arial", ... }]
Filtering
import { findFonts } from "@canva/asset";const { fonts } = await findFonts({ fontRefs: ["FONT_REF_GOES_HERE"] });console.log(fonts); // => [ { name: "Arial", ... }]
Parameters
Options for filtering the returned fonts.
An array of font references. If defined, only the fonts with the specified references will be returned.
Returns
A Promise
that resolves with the following object:
The result of requesting a list of available fonts.
An array of fonts.
An individual font.
A unique identifier that references a font in Canva's backend.
The name of the font.
An array of font weights that the font is available in.
An individual font weight.
The name of the font weight.
The possible values depend on the font, but may be any combination of the following values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
The styles the font weight is available in.
The possible values depend on the font, but may be any combination of the following values:
"normal"
"italic"
The URL of an image that contains a preview of the font.