Navigation

Tokens

Text

Text treatments that set font size, line height and letter spacing together.

On this page

Classes

ClassDeclarations
text-<name>font-size: var(--text-<name>);line-height: var(--text-<name>--line-height, normal);letter-spacing: var(--text-<name>--letter-spacing, normal);

A primary --text-<name> token creates the class; its --line-height and --letter-spacing companions are optional and fall back to normal. Family, weight and color stay separate classes.

Values

Each row shows the three values read by one class. Preset sizes reference the matching font-size token; the table resolves that reference for reading. All preset treatments include both companions.

ClassSizeLine heightLetter spacing
text-3xs.5rem8px1.50
text-2xs.625rem10px1.50
text-xs.75rem12px1.50
text-sm.875rem14px1.50
text-md1rem16px1.60
text-lg1.125rem18px1.50
text-xl1.25rem20px1.4-.01em
text-2xl1.5rem24px1.35-.015em
text-3xl2rem32px1.25-.02em
text-4xl2.25rem36px1.2-.025em
text-5xl2.5rem40px1.15-.03em
text-6xl3rem48px1.1-.035em
text-7xl3.75rem60px1.05-.04em
text-8xl4.5rem72px1.05-.04em
text-9xl6rem96px1-.045em
text-10xl8rem128px1-.05em
Compare all text treatments
text-3xs
Aa
text-2xs
Aa
text-xs
Aa
text-sm
Aa
text-md
Aa
text-lg
Aa
text-xl
Aa
text-2xl
Aa
text-3xl
Aa
text-4xl
Aa
text-5xl
Aa
text-6xl
Aa
text-7xl
Aa
text-8xl
Aa
text-9xl
Aa
text-10xl
Aa

One primary token, three declarations

--text-card registers text-card. The class always emits font size, line height and letter spacing. If --text-card--line-height or --text-card--letter-spacing is absent, its declaration uses normal; it does not preserve an inherited value.

A text treatment always writes three properties

Only the primary --text-card token is defined here. Both companion declarations still exist and use normal, replacing any inherited line height or letter spacing.

Text description
  1. The custom theme defines --text-card as 1.5rem and defines neither companion.
  2. text-card emits font-size: var(--text-card), line-height: var(--text-card--line-height, normal) and letter-spacing: var(--text-card--letter-spacing, normal).
  3. All three solid branches represent emitted declarations. The absent companions use their normal fallback rather than inheriting another line height or letter spacing.
  4. A companion on its own does not register text-card. Family, weight and color are outside this recipe.

A companion alone does not register a treatment. Add the primary size token even when the only value you want to customize is its line height or letter spacing.

A companion is a value used by this recipe, not another class name. Independent adjustments use font-<size>, leading-<name> or tracking-<name>. Under the same conditions, these single-property utilities sort after the text recipe and can override its corresponding declaration; their order in the class attribute does not decide the result.

The recipe does not load a font, select its family or weight, add margins or decide the width of a paragraph. Typography Guide owns choosing and combining treatments into a hierarchy.

Usage

Apply one treatment to a paragraph; its family, weight and color remain independent.

A paragraph keeps its size, line height and letter spacing together. Its container can grow when the same text wraps onto another line.

<p class="… text-lg">A paragraph keeps its size,…</p>
Generated CSS
@layer theme {  :root,  :host {    --font-size-lg: 1.125rem;    --text-lg: var(--font-size-lg);    --text-lg--line-height: 1.5;    --text-lg--letter-spacing: 0  }}@layer utilities {  .text-lg {    font-size: var(--text-lg);    line-height: var(--text-lg--line-height, normal);    letter-spacing: var(--text-lg--letter-spacing, normal)  }}

Customize

Add a treatment with its companions: --text-display creates text-display.

@theme {  --text-display: 3.5rem;  --text-display--line-height: 1.1;  --text-display--letter-spacing: -.03em;}
Generated CSS
@layer theme {  :root,  :host {    --text-display: 3.5rem;    --text-display--line-height: 1.1;    --text-display--letter-spacing: -.03em  }}@layer utilities {  .text-display {    font-size: var(--text-display);    line-height: var(--text-display--line-height, normal);    letter-spacing: var(--text-display--letter-spacing, normal)  }}