Skip to content

Foundations

Spacing and density

Eight spacing steps on a 4px grid, up to 64px, and three density modes.

Grid
4pt, strict
Steps
8, from 4 to 64px
Densities
Dense, standard, relaxed

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.

64px is the maximum

For more separation, add a rule, a heading or a different layout. Page margins and gutters belong to the layout 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.

Browser text size
Resets when you leave 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).

What changes at each breakpoint
WidthLayout
Under 640pxOne column. Tables scroll in their own region; nothing else scrolls sideways.
640 to 959pxOne column, wider. Navigation in a drawer.
960 to 1279pxSidebar and content. Secondary panels stack below.
1280px and upNavigation, content and a context column, such as "On this page" or a record detail pane.
1600px and upContent stops growing; extra width becomes margin.
PhonesFixed 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-*).