Foundations
Spacing and density
Eight spacing steps on a 4px grid, up to 64px, and three density modes.
The 4pt grid
Steps are named by their multiple of 4px: step 3 is 12px, step 6 is 24px. Missing numbers do not exist. Press G to overlay the grid.
Rules
Tokens are stored in px and emitted in rem. The build fails on any off-grid length in component CSS.
Use
- Multiples of 4px for every gap and padding.
- Only the eight steps.
- Height tokens for controls (28, 36, 44px), content centered.
- Semantic tokens such as "inset control".
- Fixed 1px borders and 2px focus rings, outside the grid.
Avoid
- 2px half-steps or 6, 10, 14px nudges.
- Padding adjusted for a border.
- Vertical padding to set height.
- Raw steps where a semantic token fits.
- Fixed pixel layouts.
Semantic spacing
Text size scaling
Browser text size scales every gap, control and row together (WCAG 1.4.4). Try it on this page.
Density
Each mode sets row and control height, text size, line height, cell padding and icon size. Set data-density on any ancestor; nested areas can differ. Row counts are for a 750px table.
26 rows
Dense, 28px. Registries, queues, audit logs.
20 rows
Standard, 36px. The default.
15 rows
Relaxed, 48px. Touch and long sessions.
Sizes and targets
The minimum target is 24px (WCAG 2.5.8, AA). Dense controls are 28px; relaxed controls are 44px (WCAG 2.5.5).
Breakpoints and layout
Four breakpoints, all multiples of 16px. Design desktop first; pages must reflow at 400% zoom, a 320px window (WCAG 1.4.10).
| Width | Layout |
|---|---|
| Under 640px | One column. Tables scroll in their own region; nothing else scrolls sideways. |
| 640 to 959px | One column, wider. Navigation in a drawer. |
| 960 to 1279px | Sidebar and content. Secondary panels stack below. |
| 1280px and up | Navigation, content and a context column, such as "On this page" or a record detail pane. |
| 1600px and up | Content stops growing; extra width becomes margin. |
| Phones | Fixed bars, toasts and drawers keep clear of the notch and the home indicator. Pages need viewport-fit=cover; pad your own fixed bars with env(safe-area-inset-*). |