Typography

The text roles YolkUI components use. One class sets the size, line height, weight and tracking, and each role points at a step of Tailwind's type scale.

Text roles

A component writes text-label, not text-sm font-medium. Each role is a Tailwind v4 theme variable that carries its own line height, weight and tracking, so one class sets all four. Size is the font size over the line height, and the roles with an empty last column are there for your own pages.

RoleSizeWeight, trackingUsed by
text-display48/52px700, tight
text-h136/40px700, tight
text-h230/36px600, tight
text-h324/32px600
text-h420/28px600Avatar initials at 2xl
text-h518/28px600
text-h616/24px600Card, Dialog and Alert Dialog titles
text-body-lg18/28px400
text-body16/24px400Text in fields and menu rows below the md breakpoint, so iOS never zooms in
text-body-sm14/20px400Most component text: menu rows, descriptions, Accordion, Alert, Toast, Calendar
text-label14/20px500Button, Label, Tabs, Toggle, Segmented Control, Accordion triggers
text-label-sm12/16px500Button, Tabs, Toggle and Segmented Control at their smallest size
text-caption12/16px400Badge, Tooltip, Field descriptions and errors, menu group labels and shortcuts, Calendar weekdays
text-overline12/16px600, 0.06em
text-overline-mono12/16px400, 0.06em, mono capitals
text-code14/20px400

Use a role

Write the role as one class, and add a color beside it. The role sets the size, the line height, the weight and the tracking; the color stays your choice.

<h2 className="text-h3">Billing</h2>
<p className="text-body-sm text-muted-foreground">Your plan renews on May 1.</p>
<span className="text-caption text-muted-foreground">Updated 2 minutes ago</span>

Change or add a role

Set the role again in an @theme inline block after the theme's. Here every Card, Dialog and Alert Dialog title grows to 18px, and a new text-eyebrow role becomes a class you can use anywhere.

@theme inline {
  --text-h6: var(--text-lg);
  --text-h6--line-height: var(--text-lg--line-height);

  --text-eyebrow: var(--text-xs);
  --text-eyebrow--line-height: var(--text-xs--line-height);
  --text-eyebrow--font-weight: var(--font-weight-medium);
  --text-eyebrow--letter-spacing: var(--tracking-wide);
}

Fonts

The roles set text in font-sans and code in font-mono, so they use your fonts once Theming points the two at them. The sizes behind the roles are Tailwind's type scale, unchanged.