Type Scale
Typography starts with size. The type scale is a set of clamp() steps: a
minimum, a preferred viewport-relative value, and a maximum. Nothing jumps at a
breakpoint, and the scale follows the user’s root font size.
Most pages need none of these classes: the base layer already styles h1–h6,
p, links, lists, small, blockquote, and code. Reach for a class when a
specific piece of copy needs a different treatment.
The scale
Section titled “The scale”text-4xltext-3xltext-2xltext-xltext-lgtext-basetext-smtext-xs| Token | Class | Range | Use for |
|---|---|---|---|
--nc-text-xs |
text-xs |
0.75–0.8125rem |
Captions, labels, metadata |
--nc-text-sm |
text-sm |
0.875–0.9375rem |
Secondary copy, table text |
--nc-text-base |
text-base |
1–1.0625rem |
Body text |
--nc-text-lg |
text-lg |
1.125–1.25rem |
Ledes, large body copy |
--nc-text-xl |
text-xl |
1.25–1.5rem |
Card titles, small headings |
--nc-text-2xl |
text-2xl |
1.5–1.875rem |
Section headings |
--nc-text-3xl |
text-3xl |
1.875–2.5rem |
Page headings |
--nc-text-4xl |
text-4xl |
2.25–3.25rem |
Hero headings |
The class sets font-size only. Pair it with a leading utility when the default
line height is wrong for the size, and override --text-size for one-off values:
<p class="text-2xl leading-tight">A large heading-like line</p><p class="text-lg leading-relaxed">A longer lede that needs more air.</p><p class="text-lg" style="--text-size: 1.4rem">One-off size</p>See Line Height for the leading scale and Weight for emphasis.
Headings and display type
Section titled “Headings and display type”The base layer already styles the heading elements with the fluid scale. When you
need a heading size on a non-heading element, use the h1–h6 classes:
| Class | font-size |
|---|---|
h1 |
4.5rem |
h2 |
2.5rem |
h3 |
1.75rem |
h4 |
1.25rem |
h5 |
1rem |
h6 |
0.875rem |
Display classes are larger, for hero sections:
| Class | font-size |
|---|---|
display-1 |
74px |
display-2 |
62px |
display-3 |
48px |
display-4 |
34px |
Both sets read --font-size, --line-height, and --font-weight, so one class
can be re-tuned without touching the rest:
<h2 class="h2" style="--font-size: 2rem">Section title</h2><p class="display-3" style="--font-weight: 700">Large display line</p>Do not add text-4xl to every h1; the base layer already sizes it. Use a class
when a specific context needs a different size, such as a compact card title.
Responsive type
Section titled “Responsive type”The scale is already responsive. Avoid adding a breakpoint for every heading. If a hero needs a different ratio from the rest of the page, override the token on that scope:
.hero { --nc-text-4xl: clamp(3rem, 2rem + 5vw, 5rem);}The size classes have no breakpoint variants. The text families do; each one is documented on its own page.
Accessibility
Section titled “Accessibility”- Sizes are in
remandclamp(); do not sethtml { font-size: 10px }to “fix” the scale. That breaks user zoom. - Keep body text at least
1remand line height at least1.5for long copy. - Do not rely on size alone to show hierarchy. Weight, spacing, and position do more work than another 2px.
- For readable line length, use
max-w-prosefrom Sizing.
Use in CSS
Section titled “Use in CSS”The class is the markup shorthand. The same style in a component stylesheet:
.lede { font-size: var(--nc-text-lg);}.hero { font-size: var(--nc-text-4xl);}The Sass subpackage exposes the same values: nc.nc-text("lg") and
nc.nc-text("4xl"). See Sass subpackage.
A breakpoint is the same declaration inside a media query; you do not need a second class.