Design tokens explained: what they are and how to structure them
Design tokens are named values that store design decisions, such as color-text-primary or space-4, so the same decision can be used in design tools and code.
Why tokens matter
- One source of truth for color, spacing, type and more
- Easy theming, like light and dark modes or multiple brands
- Changes in one place flow everywhere they are used
A common three-tier structure
- Primitive (or base/global) tokens: raw values. Example:
blue-600 = #2563eb,space-16 = 16px. - Semantic (or alias) tokens: describe purpose. Example:
color-action-primary = blue-600,color-text-danger = red-700. - Component tokens: specific to a component. Example:
button-primary-bg = color-action-primary.
Components reference semantic or component tokens, not primitives. That is what makes themes possible: swap what the semantic tokens point to, and the UI updates.
Naming tips
- Name by role, not appearance (
color-border-subtlerather thanlight-gray) - Keep a consistent order, such as category–property–variant–state
- Avoid going too granular too early; many teams start with primitives and semantic tokens only
Tooling Tokens are often stored in JSON and transformed into CSS variables, platform-specific formats and design tool variables via build tools. The W3C Design Tokens Community Group has worked on a shared format to improve interoperability.
How many tiers does your token setup use? And what is the token naming argument your team still has not settled?
Comments · 3
The tough part is naming. Semantic names like 'text-primary' survive a rebrand where 'blue-500' doesn't.
Tokens are the mechanism that lets design and engineering move at the same speed. The payoff comes when you need to rebrand or add a theme.
How many layers of tokens are too many? I've seen systems with three tiers and wonder if that's overkill.