Design tokens

On this page 7

Design tokens are named, platform-neutral values that store the visual decisions of a design system, such as colors, spacing, typography, radii, shadows and motion timings, in a single source of truth. In the design workflow, they replace hard-coded values like #1A73E8 or 16px with meaningful names like color.action.primary or space.md, which design tools and code on every platform can reference.

Because the same token feeds design files, web CSS, iOS and Android code, one change propagates everywhere. This makes tokens the connective layer between design and engineering, and the foundation for theming, dark mode and multi-brand products.

How design tokens work

A design token is a name-value pair with a type, stored in a structured, tool-agnostic format, usually JSON. A build step transforms these source files into platform outputs such as CSS custom properties, Sass variables, Swift constants or Android resources.

Tokens can reference other tokens through aliases. A semantic token such as color.text.danger points to a primitive token such as color.red.600, so changing the primitive updates every dependent decision while the names used in components stay stable.

The Design Tokens Community Group of the W3C has published a specification for a common interchange format, defining token types, the $value and $type properties and the curly-brace alias syntax such as {color.red.600}. Shared formats let design tools and build pipelines exchange tokens without custom converters, although tool support still varies.

Token tiers and naming

Mature systems organize tokens in three tiers of increasing specificity. Each tier answers a different question, and components should consume the semantic or component tier rather than raw primitives.

TierAlso calledExamplePurpose
Primitive tokensGlobal, core or base tokenscolor.blue.500Define the full available palette and scales
Semantic tokensAlias or decision tokenscolor.action.primaryAssign meaning and intent to primitives
Component tokensSpecific tokensbutton.primary.backgroundBind a decision to one component part
The three common token tiers

Names follow a consistent structure from general to specific, typically category, property, variant and state, as in color.background.surface.hover. Names describe purpose, not appearance: color.text.subtle survives a palette change, while color.text.gray becomes misleading the moment the value turns blue.

Token categories and typical values

Design tokens cover any visual property that should be decided once and reused. The table lists the categories most systems define and how values are usually expressed.

CategoryExample tokenTypical valueCommon output
Colorcolor.border.defaultHex, RGB or OKLCH valueCSS custom property
Spacingspace.400Multiples of a 4 or 8 px baserem or density-independent pixels
Typographyfont.body.mdFamily, size, weight, line heightComposite text style
Border radiusradius.sm2 to 8 pxCorner radius values
Elevationshadow.overlayOffset, blur, spread, colorBox shadow or platform elevation
Motionduration.fast100 to 200 ms with easing curveTransition timing values
Breakpointsbreakpoint.lg1024 pxMedia query values
Common token categories

Composite tokens group several values, such as a typography token combining family, size, weight and line height. They reduce mismatches but are harder to transform for platforms that handle the properties separately.

Design tokens are often confused with style variables, shared styles and component libraries. The differences lie in scope and in whether a value can travel across platforms.

ApproachWhere it livesCross-platformMain limitation
Hard-coded valuesScattered in code and filesNoEvery change is manual and error-prone
CSS or Sass variablesOne web codebaseNoLocked to one technology
Shared styles in a design toolOne design tool libraryNoNot readable by code directly
Design tokensPlatform-neutral source filesYesNeeds a build pipeline and governance
Component libraryCoded and designed componentsPartlyConsumes tokens rather than replacing them
Design tokens and neighboring concepts

Tokens feed the component library rather than compete with it, and they make developer handoff more precise because specifications reference token names instead of raw numbers that developers must interpret.

Theming, governance and common pitfalls

The strongest argument for tokens is theming. Light and dark modes, high-contrast themes and sub-brands are implemented by remapping semantic tokens to different primitives while component code stays unchanged.

  • Too many tokens: hundreds of one-off component tokens make the system harder to use than the values they replaced.
  • Appearance-based names: names like blue-button break as soon as the brand or theme changes.
  • Skipping the semantic tier: components that use primitives directly cannot be themed without editing each component.
  • Two sources of truth: if designers edit the design tool and developers edit JSON separately, values drift within weeks.
  • No versioning: renaming or deleting tokens without semantic versioning and deprecation notices breaks consuming products.

Healthy token workflows keep the source in version control, run automated builds on every change, and treat renames as breaking changes that require release notes and a migration period.

Explained without jargon

Design tokens are a shared dictionary of style decisions. Instead of every designer and developer typing the exact shade of blue or the exact amount of space by hand, they all use the same agreed name, such as primary color or medium spacing.

It works like a recipe that says use the house sauce rather than listing its ingredients each time. If the chef changes the house sauce, every dish that uses it changes too. In the same way, changing one token updates the website and the apps at once.

A typical use case

A bank runs a web portal, an iOS app and an Android app, maintained by three separate teams. A brand refresh requires a new primary color and a dark mode, and a first estimate shows more than 1,400 hard-coded color values spread across the three codebases.

The design system team defines about 120 primitive and 90 semantic tokens in DTCG-format JSON, links them to the design tool library, and uses a build pipeline to generate CSS custom properties, Swift constants and Android resources. Each team then replaces raw values with semantic token references over two sprints.

The brand color change itself becomes a single edit to one primitive token, and dark mode ships as a second mapping of the same semantic tokens. Later contrast fixes are made once and reach all three platforms in the next release.