Skip to content

Design Token

A named value for a design decision — a color, spacing step, or type size — stored once and used everywhere instead of a raw value.

Deliverables & Artifacts

A design token is a named value standing in for a design decision: color-action-primary instead of #6520D8, space-4 instead of 16px, text-body instead of a font size and line height written out.

The value matters less than the name. A hex code pasted into a component records what the color is; a token records what it is for, which is the information anybody changing it later actually needs.

The three layers

Tokens work best in tiers, and the middle tier is the one that does the work.

LayerExampleNamesUsed directly?
Primitiveblue-600 = #6520D8The valueNo
Semanticcolor-action-primary → blue-600The jobYes, this is the layer products use
Componentbutton-background-primary → color-action-primaryOne component's useWhere a component needs its own hook

Skipping the semantic layer is the common shortcut and the expensive one. A product built directly on blue-600 cannot be themed, cannot be rebranded without a search and replace, and cannot answer the question of whether a given blue meant "this is the primary action" or "this happened to be the blue we used".

What tokens actually buy

One place to change a decision. A rebrand becomes a set of value changes rather than a repaint. This is the benefit everyone cites and the least common in practice, because rebrands are rare.

Themes that work. Light, dark, high contrast, and in some products a customer's own colors. Each is a different mapping of the same semantic names.

A shared vocabulary. Designers and engineers arguing about space-4 are having a much shorter conversation than designers and engineers arguing about whether that gap is 14 or 16 pixels.

Constraint. A spacing scale with seven steps means nobody invents an eighth. Tokens sit underneath the atoms in atomic design. Most of the visual inconsistency in growing products comes from values chosen individually, and a token set removes the opportunity.

Machine-readable decisions. Tokens can be exported to CSS, iOS, Android and documentation from one source, and they give a coding assistant something better to draw on than an invented value.

Naming, which is the hard part

Token systems fail at naming more often than at tooling.

Name the purpose, not the appearance. color-danger survives a decision to make destructive actions orange. color-red does not.

Be consistent about order. Something like category, role, variant, state, applied the same way every time, so a name can be guessed rather than looked up.

Do not encode the value. space-16 is a lie waiting to happen the moment the scale changes; space-4 as the fourth step survives.

Resist inventing tokens for single uses. A token used once is a variable with extra ceremony, and a set full of them stops being learnable.

The test of a naming scheme is whether somebody who has never seen it can guess the token for a warning background on the second attempt.

Where token systems go wrong in practice

Generated in bulk before anything uses them. Nine hundred tokens produced from a design tool, of which the product uses forty, and nobody can tell which forty.

Design and code drift. The token exists in both places with different values, and each team trusts their own. This is the failure that ends confidence in a design system, because after it happens once, engineers stop believing the design files.

Primitives leaking into components. Every component referencing blue-600 directly is a component that will not theme.

No owner for additions. A team needs a token that does not exist, adds one locally, and the set forks quietly.

Adopting them in a product that already exists

Retrofitting tokens into a live codebase is where most token projects stall, and the approach that works is unglamorous.

Audit what is actually in use. Extract every color, spacing value and font size from the codebase before designing anything. The result is usually alarming and it is the real starting point, since the intended palette and the deployed one are different sets.

Collapse before you name. Fourteen greys are rarely fourteen decisions. Group them into the handful of jobs they were serving, and accept that some collapsing changes the appearance slightly.

Convert as you touch. A migration that pauses feature work will be abandoned. Converting each component the next time somebody works on it is slower and it finishes.

Block new raw values. A lint rule rejecting hex codes in components stops the problem growing while the migration runs, and it is more effective than any amount of encouragement.

In practice

A company adds a dark theme to a product built without semantic tokens.

The work looks straightforward and is not. Components reference raw values scattered across three years of code, and there is no way to tell which greys were backgrounds, which were borders and which were disabled text, because they are all the same handful of hex codes used for different reasons.

The theme ships about seventy per cent applied. The remaining thirty is a long tail of screens that look wrong in ways that take a fortnight to find, because each one requires deciding what the original developer had meant.

The token work that would have prevented this is not large: a semantic layer, a few dozen names, adopted by components as they are touched. It is simply not urgent until the day it becomes very urgent.

Where teams get it wrong

  • No semantic layer. Primitives applied directly cannot be themed and record nothing about intent.
  • Names describing appearance. color-red outlives the decision to stop being red.
  • Bulk generation. Hundreds of tokens nothing references, obscuring the ones that matter.
  • Values in names. space-16 breaks the first time the scale changes.
  • No contribution route. When adding a token is slower than hard-coding a value, people hard-code the value.

Frequently Asked Questions