Typography

The theme system generates the full Material Design 3 type scale as Tailwind utility classes. Font families and sizes are configurable through defineConfig.

Type scale

5 roles × 3 sizes = 15 classes. Use them as Tailwind text utilities:

html
<h1 class="text-display-lg">Display Large</h1>
<h2 class="text-headline-md">Headline Medium</h2>
<p class="text-body-lg">Body Large</p>
<span class="text-label-sm">Label Small</span>

Full reference

ClassFont sizeLine heightWeight
text-display-lg57px64px400
text-display-md45px52px400
text-display-sm36px44px400
text-headline-lg32px40px400
text-headline-md28px36px400
text-headline-sm24px32px400
text-title-lg22px28px400
text-title-md16px24px500
text-title-sm14px20px500
text-label-lg14px20px500
text-label-md12px16px500
text-label-sm11px16px500
text-body-lg16px25px400
text-body-md14px20px400
text-body-sm12px16px400

Font families

Two conceptual families map to different roles:

FamilyApplied toDefault
expressivedisplay, headlineRoboto, sans-serif
neutraltitle, label, bodyRoboto, sans-serif

Override them in defineConfig:

ts
defineConfig({
  sourceColor: '#6750A4',
  fontFamily: {
    expressive: ['Playfair Display', 'Georgia', 'serif'],
    neutral: ['Inter', 'system-ui', 'sans-serif'],
  },
})

Values are used directly as CSS font-family — include fallbacks at the end.

Loading fonts

defineConfig declares the font families but does not load them. Add your fonts to the document <head>:

html
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
  href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=Playfair+Display:wght@400;700&display=swap"
  rel="stylesheet"
/>

Or via CSS:

css
@import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');

Customizing sizes and weights

Use fontStyles in defineConfig to override any role/size combination. Only the properties you specify are changed — everything else stays at the Material Design defaults.

ts
defineConfig({
  fontStyles: {
    display: {
      large: {
        fontSize: 4,         // rem
        lineHeight: 4.5,     // rem
        fontWeight: 300,
        letterSpacing: -0.02,
      },
    },
    headline: {
      medium: { fontWeight: 600 },
    },
    body: {
      large: { lineHeight: 1.75 },
    },
  },
})

FontStyle properties

PropertyTypeDescription
fontSizenumberSize in rem
lineHeightnumberHeight in rem
fontWeightnumberCSS font-weight
letterSpacingnumber (optional)Spacing in rem

Using text-* with color tokens

Combine typography classes with color tokens for complete text styling:

html
<h1 class="text-display-lg text-on-surface">Page title</h1>
<p class="text-body-lg text-on-surface-variant">Supporting text</p>
<span class="text-label-md text-primary">Category</span>