Design tokens in practice
How we structure color, type, spacing, and motion tokens for Tailwind v4 projects.
Design tokens are the contract between design and engineering. Here's how we structure them for Tailwind v4 projects.
The four layers
- Primitive tokens — raw values (color scales, spacing scale)
- Semantic tokens —
--background,--foreground,--primary - Component tokens — button radius, card padding (rarely needed)
- Utility classes —
ds-display,ds-headlinefor one-off patterns
Color
We use OKLCH for perceptual uniformity. Each mode (light/dark) gets its own semantic mapping — never copy-paste hex values between modes.
Typography
Three roles: display (Instrument Serif), body (Geist Sans), mono (Geist Mono). Size scale stays tight — 5–6 sizes cover 95% of UI.
Motion
Define duration and easing tokens once. Respect prefers-reduced-motion everywhere.
Related articles
Shipping dark mode right
Semantic tokens, contrast checks, and the three mistakes that make dark mode feel like an afterthought.
Read articleOG images that actually convert
Dimensions, typography, and contrast rules for 1200×630 cards that look sharp everywhere.
Read article