Spacing and tokens
Spacing, type, elevation and motion are chosen by role, never by number. The values change with the density, so data-density="compact" tightens everything at once, and the corner radius is an axis of its own.
Spacing roles
Choose by relationship, not by look: parts of the same thing use gap-inline or gap-items, distinct groups gap-group, separate surfaces gap-section. Every spacing utility takes the roles: p-inline, pb-group, -mx-inline. The Compact column is data-density="compact" (or the data-theme="compact" alias), at any radius; Theming covers both axes.
| Utility | Role | Default | Compact |
|---|---|---|---|
gap-inline | icon + text, parts inside one control, chip or row | 0.375rem | 0.25rem |
gap-items | siblings in a list or stack: cards, chips, buttons, form fields | 0.5rem | 0.375rem |
gap-group | groups inside a surface: header vs body, dialog sections | 1rem | 0.75rem |
gap-section | surfaces on a page: board columns, stat cards, a page's blocks | 1.5rem | 1rem |
px-inset-chip / py-inset-chip | pills, badges, chips, kbd | 0.5rem / 0.125rem | 0.375rem / 0.125rem |
px-inset-item / py-inset-item | menu and list items, small cards, table cells | 0.625rem / 0.5rem | 0.5rem / 0.375rem |
px-control-x | buttons, inputs, selects | 0.875rem | 0.625rem |
p-inset-surface | cards, dialogs, panels, popovers | 1.5rem | 1rem |
p-control-inset | the rim of a control-height bar around -sm items | 2px | 2px |
- A component never sets outer margin: the parent spaces its children with gap.
- Sizes (
h-control,size-control-sm) are not spacing; prefer the size tokens.
Typography
Each step sets size and line height, and the meta, title and display steps a weight. Caption, body-sm and body keep the weight they inherit, so a <strong> or <th> stays bold.
| Utility | Role | Size / line / weight |
|---|---|---|
| eyebrows, kickers, overlines (with tracking-meta) | 11/14/500 | |
| text-caption | hints, timestamps, table footnotes | 12/16 |
| text-body-sm | secondary text, descriptions in dense UI | 13/18 |
| text-body | default UI and reading text | 14/20 |
| text-title-sm | card, panel and list-group titles | 15/20/600 |
| text-title | dialog, drawer and section titles | 18/24/600 |
| text-display-sm | page titles, stat values | 24/28/650 |
| text-display | hero numbers, empty-state headlines | 28/32/700 |
Elevation
In-page surfaces (cards, board columns, panels) use shadow-surface and rounded-surface. Anything that floats above the page uses surface-floating: popovers, menus, select lists, hover cards and toasts. Dialogs and drawers take the floating shadow, border and radius but stay opaque reading surfaces in every theme.
Layers and motion
| Utility | Value | Role |
|---|---|---|
z-sticky | 20 | sticky headers, a Floating bar |
z-overlay | 40 | dialog and drawer backdrops and content |
z-popover | 50 | popovers, menus, list popups, tooltips |
z-toast | 60 | the toast region, above everything else |
duration-micro | 140ms | hover and press feedback, popovers, menus, tooltips |
duration-panel | 180ms | panels that resize or slide: accordion, sidebar, toasts |
duration-dialog | 200ms | dialogs and their backdrop |
ease-standard | cubic-bezier(0.2, 0, 0, 1) | every token-timed transition |
prefers-reduced-motion: reduce collapses every transition and animation in the base layer; components add motion-reduce: only to swap a movement for a fade.
Touch targets
On a coarse pointer, controls reach a 44px hit area without changing how they look on a desktop: the touch-target class adds a centred ::before to buttons, toggles, tabs, checkboxes, radios and switches. Rows that stack closer grow with pointer-coarse: instead.
The narrow breakpoint
narrow: applies at 760px and below. Write the wide layout first and override it: flex-row narrow:flex-col. It's about the viewport, not density; prefer container queries for a component that lives in panels of different widths. Colours are on the Tone and colour page.