Space & shapeMarkdown
Spacing
Spacing uses a closed 12-step scale on a 4px grid from 4px to 128px. Steps 1–12 (4–48px) govern components, and steps 16–32 (64–128px) govern sections.
Spacing scale
| Class | CSS var | px | rem | Scope | Bar |
|---|---|---|---|---|---|
| p-1 / gap-1 | --space-1 | 4px | 0.25rem | Components (4–48px) | |
| p-2 / gap-2 | --space-2 | 8px | 0.5rem | Components (4–48px) | |
| p-3 / gap-3 | --space-3 | 12px | 0.75rem | Components (4–48px) | |
| p-4 / gap-4 | --space-4 | 16px | 1rem | Components (4–48px) | |
| p-6 / gap-6 | --space-6 | 24px | 1.5rem | Components (4–48px) | |
| p-8 / gap-8 | --space-8 | 32px | 2rem | Components (4–48px) | |
| p-10 / gap-10 | --space-10 | 40px | 2.5rem | Components (4–48px) | |
| p-12 / gap-12 | --space-12 | 48px | 3rem | Components (4–48px) | |
| p-16 / gap-16 | --space-16 | 64px | 4rem | Sections (64–128px) | |
| p-20 / gap-20 | --space-20 | 80px | 5rem | Sections (64–128px) | |
| p-24 / gap-24 | --space-24 | 96px | 6rem | Sections (64–128px) | |
| p-32 / gap-32 | --space-32 | 128px | 8rem | Sections (64–128px) |
Use --space-1 through --space-12 inside cards, controls, and form groups. Reserve --space-16 through --space-32 for section padding and homepage white space.
Usage
Apply spacing utilities in Tailwind CSS or custom properties in CSS:
<section className="py-16">
<div className="flex flex-col gap-4 rounded-lg border border-border bg-card p-6">
<h2 className="font-display text-h4">Card heading</h2>
<p className="font-sans text-body text-muted-foreground">
Component padding stays within 4–48px.
</p>
</div>
</section>.panel {
padding: var(--space-6);
display: grid;
gap: var(--space-4);
}Do and don't
Do: Separate component and section scales
Use steps 1–12 (4–48px) for padding and gaps inside components, and steps 16–32 (64–128px) for vertical section rhythm.
Don't: Use arbitrary spacing values
Do not write p-[18px] or gap-5 because off-grid values break alignment and fail to compile under the locked Tailwind theme.
Accessibility
- Emit all spacing tokens in
rem(px / 16) so layout breathing room scales proportionally with browser text zoom. - Maintain at least
8px(--space-2) between adjacent interactive targets to prevent accidental taps.
Rationale
Locking spacing to 12 discrete steps removes arbitrary pixel nudging and keeps component density consistent across pages.