Skip to content
Design Academy My progress

Stage 6 · Lesson 5 of 13

Design tokens and semantic tokens

Naming decisions instead of values.

  • Intermediate
  • 35 min
  • 3 check questions
  • Exercise: 1 h

By the end of this lesson you can

  • Explain design tokens and their tiers.
  • Write token names that are clear and scalable.
  • Understand how tokens flow from design to code.

The idea

Design tokens are named values that store design decisions: colours, spacing, type sizes, radius, shadows, durations. They are the shared source of truth between design tools and code.

Tiers

  • Primitive (global) tokens: raw values. blue-600: #1D4ED8, space-4: 16px.
  • Semantic (alias) tokens: purpose. color-action-primary: {blue-600}, space-inset-md: {space-4}.
  • Component tokens (optional): specific uses. button-primary-background: {color-action-primary}.

Naming

A common pattern is category, then property, then variant, then state: color-text-secondary, color-border-input-focus. Names should describe purpose, be predictable and avoid describing appearance in semantic tokens.

From design to code

Tokens are often stored as JSON, edited in a design tool or a repository, and transformed by a build tool into CSS variables, iOS and Android values. One change updates every platform.

Why it matters in real projects

Tokens make consistency enforceable across design and every platform. They enable theming, rebrands and accessibility fixes in one place. Designers who understand tokens collaborate much more effectively with engineers and can work on any modern design system.

A realistic example

A retailer runs a website, an iOS app and an Android app. Their "primary green" differs slightly on each because values were copied by hand.

The team defines tokens in JSON: primitives for the green scale and semantics such as color-action-primary. A build step outputs CSS variables, Swift and Kotlin constants. When accessibility testing shows the green fails contrast on white, they change one primitive mapping and all three platforms update in the next release.

Step by step

  1. Collect raw values

    List the colours, spacing, radius and type values in use.

  2. Define primitives

    Name the scales, such as grey-100 to grey-900.

  3. Define semantics

    Create purpose-based tokens pointing to primitives.

  4. Agree naming

    Write a naming pattern with developers.

  5. Apply in design

    Use variables that mirror the tokens.

  6. Trace a change

    Change one primitive and follow it through to all uses.

Common mistakes

  • Mistake Semantic tokens named by colour ("color-blue-button").

    Instead Name by purpose ("color-action-primary").

  • Mistake Too many component tokens too early.

    Instead Start with primitives and semantics.

  • Mistake Design and code tokens drifting apart.

    Instead Keep one source of truth and sync it.

Check your understanding

Choose an answer, then check it. There is an explanation either way.

Question 1 of 3Which is a semantic token?
Show answer

color-text-error. It describes purpose.

Question 2 of 3What is the main benefit of tokens?
Show answer

A shared source of truth across design and platforms. One change updates everywhere.

Question 3 of 3What format are tokens often stored in?
Show answer

JSON. JSON is easy to transform into platform code.

Practice exercise

Exercise · about 1 h

Token set

Write a small token set for a product.

Steps

  1. Define primitive colour, spacing and radius tokens.
  2. Define 10 to 15 semantic tokens.
  3. Write them in a simple JSON structure.
  4. Map three components to the semantic tokens.

Deliverable

A token JSON file and a mapping table for three components.

Self-assessment

Tick each item when it is true of your exercise. Be honest; this is for you.

4 items

Summary

  • Design tokens are named design decisions.
  • Use primitive, semantic and optional component tiers.
  • Name by purpose with a predictable pattern.
  • Tokens flow from one source to every platform.

Further reading

Third-party sources, chosen for reliability. They open in a new tab.

Your notes

Marking complete updates your course and roadmap progress.

Back to UI design and design systems Roadmap