Skip to main content

Spacing

A 4 px scale and named layout distances that follow the density mode.

A 4 px scale. Tailwind's spacing utilities map straight onto it: p-1 is 4 px, p-4 is 16 px, gap-2 is 8 px. Half-steps (2, 6 and 10 px) exist for the inside of components only (DECISIONS.md #19).

Semantic layout tokens name the distances that recur, and they follow the density mode: gap-stack-md between form fields (16 px, 12 px compact), gap-inline-sm between buttons (8 px), p-card-x and p-card-y inside a card, gap-gutter between grid columns and px-margin at the page edge. Controls come in three heights, h-control-sm, h-control-md and h-control-lg (28, 32 and 40 px; 24, 28 and 32 px compact), and every interactive target is at least 24 px (WCAG 2.2 2.5.8).

In practice

Form section (stack-md between fields, inline-sm between buttons)

In this section

  • Scale: the primitive steps and the semantic tokens with their compact values.
  • Usage: which token for which distance.