Design4 min

Design tokens explained: what they are and how to set them up

Design tokens explained simply: primitive vs semantic tokens, naming conventions, theming and dark mode, and how tokens connect Figma to code.

Saurabh YadavFounder, Design Studio by Saurabh
DesignDesign tokensDesign systemsFigma variables
Share

Every product has a hundred tiny decisions: this blue, that spacing, this corner radius. Design tokens are how you name those decisions once and use them everywhere, in Figma and in code.

What design tokens are

A design token is a named value for a design decision. Instead of using "#5B3FE4" in 40 places, you use a token called something like "color.primary". Change the token, and everything that uses it updates.

Tokens usually cover:

  • Colours
  • Typography (font family, size, weight, line height)
  • Spacing
  • Corner radius
  • Shadows and elevation
  • Motion (durations and easing)

The three layers of tokens

LayerExample nameExample valuePurpose
Primitive (base)violet-600#5B3FE4The raw palette
Semantic (alias)color.action.primary→ violet-600What the value is for
Componentbutton.primary.background→ color.action.primaryWhere it's used

Primitives describe what a value is. Semantic tokens describe why it's used. That separation is what makes theming possible.

Tip

Designers and developers should mostly use semantic tokens. If people reach for primitives like "violet-600" directly, your dark mode will break the day you build it.

Why tokens matter

  • Consistency: the same decisions everywhere, by default.
  • Theming and dark mode: swap the values behind semantic tokens, not every component. See designing dark mode properly.
  • Faster changes: a brand refresh becomes an update to tokens, not a redesign.
  • Shared language: designers and developers call things by the same names.

Naming tokens

Good names are predictable. A common structure is:

category . purpose . variant . state

For example: color.text.primary, color.text.muted, color.surface.raised, color.border.focus, space.4, radius.md.

Rules I follow:

  • Name by purpose, not by appearance ("color.text.danger", not "color.red").
  • Keep the structure consistent across categories.
  • Avoid names that only make sense to one person.

Tokens in Figma

Figma variables are the natural home for tokens on the design side. Create collections for primitives and semantic tokens, use modes for light and dark themes, and apply semantic variables in components. I walk through a full setup in setting up a Figma design system.

Tokens in code

Developers typically store tokens in JSON and turn them into CSS variables, iOS and Android values using a build tool such as Style Dictionary. The Design Tokens Community Group has also published a standard format for token files, which helps tools exchange tokens.

Note

The goal is one source of truth. Whether tokens start in Figma or in code, agree where the master copy lives and sync from there.

Getting started in a small team

  1. Audit colours, type sizes and spacing values in use today.
  2. Reduce them to a small, sensible scale.
  3. Create primitive tokens, then semantic tokens on top.
  4. Apply semantic tokens to your core components first.
  5. Agree a naming convention and write it down.

If you're a small team, my post on design systems for small teams covers how much system you actually need.

Work with us

Want this set up properly? Our design system agency builds Figma libraries, tokens and documentation that scale with your team.

FAQ

What are design tokens?

Design tokens are named values for design decisions such as colours, typography, spacing, radius, shadows and motion. They let teams use the same decisions consistently in design tools and code, and change them in one place.

What is the difference between primitive and semantic tokens?

Primitive tokens are raw values, like a specific shade of violet. Semantic tokens describe purpose, like the primary action colour, and point to primitives. Using semantic tokens makes theming and dark mode much easier.

Are Figma variables the same as design tokens?

Figma variables are Figma's way of storing reusable values, and they're a common way to manage design tokens on the design side. Tokens can also live in code as JSON or CSS variables and be synced with Figma.

Key takeaways

  • Tokens name design decisions so they can be reused and changed in one place.
  • Separate primitive, semantic and component tokens.
  • Name tokens by purpose, not appearance.
  • Use Figma variables with modes for themes.
  • Keep one source of truth shared by design and code.

What to do next

Count how many different greys and spacing values your product uses today. If it's more than a handful, tokens will save you time. If you'd like help building a token-based design system, tell us about your product.

Tokens are one layer of a bigger structure. See how to build a world-class design system for how they fit with components, patterns and governance.

Saurabh Yadav's Memoji

Written by

Saurabh Yadav

Founder of Design Studio by Saurabh, a UI/UX design studio in India. We design apps and websites that feel effortless, from research to shipped pixels. Most recently: Pukaar.ai, as seen on Shark Tank India, and the Demerara Bank app.

Keep reading

All articles →