TLThemeFont

See source code
Table of contents

A font definition within a theme. Maps a font style name to a CSS font-family declaration and optional font face descriptors for loading.

interface TLThemeFont {}

Example

import { TLThemeFont } from "@tldraw/tlschema";

const customSans: TLThemeFont = {
  fontFamily: "'Inter', sans-serif",
  faces: [
    {
      family: "Inter",
      src: { url: "https://example.com/Inter-Regular.woff2", format: "woff2" },
      weight: "normal",
    },
    {
      family: "Inter",
      src: { url: "https://example.com/Inter-Bold.woff2", format: "woff2" },
      weight: "bold",
    },
  ],
};

Properties

faces

optional

Font face definitions for loading. Omit for system fonts that don't need loading.

faces?: TLFontFace[];

fontFamily

CSS font-family declaration, e.g. "'Inter', sans-serif"

fontFamily: string;

icon

optional

Icon for the style panel. Accepts a string icon ID (resolved via assetUrls.icons) or a React element (TLUiIconJsx). Defaults to the built-in icon for known fonts, or 'font-draw' for custom fonts.

icon?: unknown;

Prev
TLThemeDefaultColors
Next
TLThemeFonts