Foundations
Spacing
The four-pixel spacing scale and layout rhythm.
Spacing uses a four-pixel base. The same scale applies to gaps, padding, and vertical rhythm, which keeps dense interfaces aligned without making them feel cramped.
Spacing scale#
space-00space-10.25remspace-20.5remspace-30.75remspace-41remspace-51.25remspace-61.5remspace-82remspace-102.5remspace-123remspace-164remspace-205remSpacing tokens
| Token | Value |
|---|---|
--ok-space-0 | 0 |
--ok-space-1 | 0.25rem |
--ok-space-2 | 0.5rem |
--ok-space-3 | 0.75rem |
--ok-space-4 | 1rem |
--ok-space-5 | 1.25rem |
--ok-space-6 | 1.5rem |
--ok-space-8 | 2rem |
--ok-space-10 | 2.5rem |
--ok-space-12 | 3rem |
--ok-space-16 | 4rem |
--ok-space-20 | 5rem |
Use the scale#
Prefer spacing tokens over decimal pixel values. Stack accepts a gap step that maps directly to
the scale:
<Stack gap={4}>
<Text weight="semibold">Section title</Text>
<Text size="sm" tone="muted">
Supporting content uses the same rhythm.
</Text>
</Stack>gap={4} resolves to var(--ok-space-4), or 16px. Values are intentionally finite to discourage
one-off spacing decisions.
A practical rhythm#
- Use
2or3for tight relationships inside a control group. - Use
4or6between related blocks. - Use
8to12between sections. - Use
16or more for page-level separation.
Keep spacing in the parent
Prefer a Stack gap over adding margins to every child. A single gap keeps the relationship
between items explicit and easy to change.