findFonts

API reference for the findFonts method.

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.

import { findFonts } from "@canva/preview/asset";
(async () => {
const fonts = await findFonts();
for (const font of fonts) {
console.log(font.name); // => "Arial"
}
})();
ts

A Promise that resolves with the following object:

#responseobject
Required

The result of requesting a list of available fonts.

#response.fontsarray
Required

An array of fonts.

#response.fonts[0]object
Required

An individual font.

#response.fonts[0].refstring
Required

A unique identifier that references a font in Canva's backend.

#response.fonts[0].namestring
Required

The name of the font.

#response.fonts[0].weightsarray
Required

An array of font weights that the font is available in.

#response.fonts[0].weights[0]object
Required

An individual font weight.

#response.fonts[0].weights[0].weightobject
Required

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"
#response.fonts[0].weights[0].stylesarray
Required

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"
#response.fonts[0].previewUrlstring
Optional

The URL of an image that contains a preview of the font.