Skip to content

Typography

raft-ui has one global type scale. Text sizes, line heights, weights and letter spacing come from --r-* tokens, so components and your own UI line up with each other. Font families are covered in Fonts. The Typography components (Heading, Text, Paragraph and the rest) set text in this scale for you.

Type scale

Nine steps, each a font size paired with a fixed line height. The scale is tuned for dense interfaces: steps 1 to 4 (10 to 14px) carry most of the text.

StepSampleSize / line height
1The quick brown fox jumps over the lazy dog10 / 14--r-font-size-1
2The quick brown fox jumps over the lazy dog11 / 16--r-font-size-2
3The quick brown fox jumps over the lazy dog12 / 16--r-font-size-3
4The quick brown fox jumps over the lazy dog14 / 20--r-font-size-4
5The quick brown fox jumps over the lazy dog16 / 24--r-font-size-5
6The quick brown fox jumps over the lazy dog18 / 26--r-font-size-6
7The quick brown fox jumps over the lazy dog20 / 28--r-font-size-7
8The quick brown fox jumps over the lazy dog24 / 32--r-font-size-8
9The quick brown fox jumps over the lazy dog30 / 38--r-font-size-9
Step--r-font-size-N--r-line-height-NTypical use
110px14pxMicro monospace labels, badges
211px16pxMonospace metadata
312px16pxSecondary info, captions, timestamps
414px20pxBody text and messages (default)
516px24pxLarge body, h4
618px26pxh3, panel titles
720px28pxh2
824px32pxh1, page titles
930px38pxDisplay

Always use a step’s size and line height together:

css
.my-caption { font-size: var(--r-font-size-3); line-height: var(--r-line-height-3); }

Line heights are fixed pixels so rows in dense lists stay aligned. For long-form reading, such as documents, use --r-line-height-prose (1.6) instead.

Weights

TokenBrutalElegant
--r-font-weight-regular400400
--r-font-weight-medium500500
--r-font-weight-strong700600
--r-font-weight-heavy800800

strong is each theme’s emphasis weight. Space Grotesk, Brutal’s font, stops at 700, so heavy renders as 700 in Brutal unless you load a heavier font under r-sans. See Check the font weights.

Letter spacing

TokenValueTypical use
--r-letter-spacing-tight-0.01emLarge headings
--r-letter-spacing-normal0Everything else
--r-letter-spacing-wide0.02emSmall text that needs air
--r-letter-spacing-widest0.08emUppercase eyebrows and labels

Controls

Control sizes keep their own tokens, --r-common-font-size-tiny / -small / -medium / -large. The first three point at steps 3, 4 and 4 (12, 14 and 14px). large stays at 15px, which sits between steps 4 and 5.

Text color

Every theme root (:root and any element with data-r-theme, such as a ConfigProvider that sets theme) sets color to --rw-alias-label-primary. Text inside it never falls back to the browser’s black, which would be unreadable in Elegant dark. Font family and size are not set on the root: they stay inherited from your page.