Typography Tokens

Font families, sizes, weights, and line heights

Font Families

:root {
  --s-font-sans: system-ui, -apple-system, BlinkMacSystemFont,
               'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --s-font-serif: Georgia, Cambria, 'Times New Roman', Times, serif;
  --s-font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo,
               Consolas, 'Liberation Mono', monospace;
}

Customizing Fonts

:root {
  --s-font-sans: 'Inter', system-ui, sans-serif;
  --s-font-mono: 'JetBrains Mono', monospace;
}

Font Sizes

Fluid typography that scales with viewport:

TokenMin SizeMax SizeClass
--s-text-xs0.75rem0.75rem.s-text-xs
--s-text-sm0.875rem0.875rem.s-text-sm
--s-text-base1rem1rem.s-text-base
--s-text-lg1.125rem1.125rem.s-text-lg
--s-text-xl1.25rem1.25rem.s-text-xl
--s-text-2xl1.5rem1.5rem.s-text-2xl
--s-text-3xl1.875rem1.875rem.s-text-3xl
--s-text-4xl2.25rem2.25rem.s-text-4xl
--s-text-5xl3rem3rem.s-text-5xl
--s-text-6xl3.75rem3.75rem.s-text-6xl
--s-text-7xl4.5rem4.5rem.s-text-7xl
--s-text-8xl6rem6rem.s-text-8xl
--s-text-9xl8rem8rem.s-text-9xl

Using Font Size Tokens

.headline {
  font-size: var(--s-text-4xl);
}

.caption {
  font-size: var(--s-text-sm);
}

Font Weights

TokenValueClass
--s-font-thin100.s-font-thin
--s-font-extralight200.s-font-extralight
--s-font-light300.s-font-light
--s-font-normal400.s-font-normal
--s-font-medium500.s-font-medium
--s-font-semibold600.s-font-semibold
--s-font-bold700.s-font-bold
--s-font-extrabold800.s-font-extrabold
--s-font-black900.s-font-black

Using Font Weight Tokens

.title {
  font-weight: var(--s-font-bold);
}

.subtitle {
  font-weight: var(--s-font-medium);
}

Line Heights

TokenValueClass
--s-leading-none1.s-leading-none
--s-leading-tight1.25.s-leading-tight
--s-leading-snug1.375.s-leading-snug
--s-leading-normal1.5.s-leading-normal
--s-leading-relaxed1.625.s-leading-relaxed
--s-leading-loose2.s-leading-loose

Using Line Height Tokens

.body-text {
  line-height: var(--s-leading-relaxed);
}

.display-text {
  line-height: var(--s-leading-tight);
}

Letter Spacing

TokenValueClass
--s-tracking-tighter-0.05em.s-tracking-tighter
--s-tracking-tight-0.025em.s-tracking-tight
--s-tracking-normal0em.s-tracking-normal
--s-tracking-wide0.025em.s-tracking-wide
--s-tracking-wider0.05em.s-tracking-wider
--s-tracking-widest0.1em.s-tracking-widest

Typography Presets

Headings

h1 {
  font-size: var(--s-text-4xl);
  font-weight: var(--s-font-bold);
  line-height: var(--s-leading-tight);
  letter-spacing: var(--s-tracking-tight);
}

h2 {
  font-size: var(--s-text-3xl);
  font-weight: var(--s-font-bold);
  line-height: var(--s-leading-tight);
}

h3 {
  font-size: var(--s-text-2xl);
  font-weight: var(--s-font-semibold);
  line-height: var(--s-leading-snug);
}

Body Text

body {
  font-family: var(--s-font-sans);
  font-size: var(--s-text-base);
  font-weight: var(--s-font-normal);
  line-height: var(--s-leading-normal);
}

Code

code, pre {
  font-family: var(--s-font-mono);
  font-size: var(--s-text-sm);
}

Customizing Typography

Base Size

Changing the base size affects all relative typography:

:root {
  --s-font-base: 1.125rem;  /* Larger base (18px) */
}

Custom Scale

:root {
  --s-text-xl: 1.5rem;
  --s-text-2xl: 2rem;
  --s-text-3xl: 2.5rem;
}

Responsive Typography

For responsive typography, use CSS custom properties with media queries or container queries:

.headline {
  font-size: var(--s-text-2xl);
}

@media (min-width: 768px) {
  .headline {
    font-size: var(--s-text-4xl);
  }
}

@media (min-width: 1024px) {
  .headline {
    font-size: var(--s-text-5xl);
  }
}

Or use fluid typography with clamp():

.headline {
  font-size: clamp(var(--s-text-2xl), 5vw, var(--s-text-5xl));
}

Best Practices

Hierarchy

Use consistent sizing for visual hierarchy:

.page-title { font-size: var(--s-text-4xl); }
.section-title { font-size: var(--s-text-2xl); }
.card-title { font-size: var(--s-text-lg); }
.body-text { font-size: var(--s-text-base); }
.caption { font-size: var(--s-text-sm); }

Readability

  • Body text: 16-18px with 1.5-1.75 line height
  • Long-form content: Limit line length to 60-75 characters
  • Use appropriate contrast ratios (4.5:1 minimum)
Search