Typography
Typography carries hierarchy. Every piece of text should use one of these tokens according to its importance — never a free-form font-size.
Defined in packages/pixel/tokens/fontSize.css, lineHeight.css, fontFamily.css and fontWeight.css.
Font size
| Token | Value | Sample |
|---|---|---|
--font-size-xxxs | 12px | Ag |
--font-size-xxs | 14px | Ag |
--font-size-xs | 16px | Ag |
--font-size-sm | 20px | Ag |
--font-size-md | 24px | Ag |
--font-size-lg | 32px | Ag |
--font-size-xl | 40px | Ag |
--font-size-xxl | 48px | Ag |
--font-size-xxxl | 64px | Ag |
--font-size-display | 80px | Ag |
--font-size-giant | 96px | Ag |
<kb-text>, <kb-label> and <kb-icon> resolve their size attribute against this scale, which is why an icon sized like the text beside it lines up with it.
Code
<kb-stack direction="column" spacing="quarck" align="start">
<kb-text size="xxxs">xxxs — captions and metadata</kb-text>
<kb-text size="xxs">xxs — the default body size</kb-text>
<kb-text size="xs">xs — comfortable body copy</kb-text>
<kb-text size="md">md — a component title</kb-text>
</kb-stack>Line height
| Token | Value |
|---|---|
--line-height-default | 100% |
--line-height-xs | 115% |
--line-height-sm | 120% |
--line-height-md | 133% |
--line-height-lg | 150% |
--line-height-xl | 170% |
--line-height-xxl | 200% |
Tighter values suit large display type, where 100% keeps a headline compact. Body copy wants lg or xl — the larger the measure, the more leading it needs to stay readable.
Font family
| Token | Value |
|---|---|
--font-family-base | "Roboto", sans-serif |
--font-family-highlight | "Roboto Condensed", sans-serif |
base is the default body family; highlight is reserved for headings and emphasis. Swapping these two tokens is enough to give a brand a different typographic voice without touching a single component.
!> The families are named, not bundled. Neither font ships with the package — load them yourself (Google Fonts, a self-hosted @font-face), or override the tokens with families you already serve. Without that, the browser falls back to sans-serif.
Font weight
| Token | Value | Sample |
|---|---|---|
--font-weight-regular | 400 | The quick brown fox |
--font-weight-medium | 500 | The quick brown fox |
--font-weight-bold | 700 | The quick brown fox |
Three steps, on purpose. medium is what separates a <kb-label> from a <kb-helper> at the same size — enough contrast to read as a label, not enough to read as a heading.