migulko
.net
Get a free review

2 December 2026

Design Tokens: A Practical Setup Guide

How to set up design tokens that work in Figma and in code: primitive and semantic layers, what to tokenize first, and mistakes that make tokens useless.

Taras Migulko · Product Designer & Product Owner
Design Tokens: A Practical Setup Guide

Design tokens are named values: a color, a size, a duration, a radius. Instead of writing a hex code in forty places, you write "text secondary" and define its value once. That sounds trivial. In practice, tokens decide whether your next redesign takes two weeks or six months.

I set up tokens in my own apps and in products I redesign for others. This is the practical version: what structure works, what to tokenize first and where teams usually go wrong.

Why tokens matter more than components

Components get the attention, but tokens carry the decisions. If a button uses a token for its background, changing the brand color updates every button. If it uses a hardcoded value, someone has to find and replace it by hand, and they will miss some.

Tokens also give designers and developers a shared vocabulary. "Use spacing 16" and "use the large gap token" are both clear. "Make it a bit more spacious" is not.

The two-layer structure

I use two layers in almost every project, sometimes three.

Primitive tokens

These are raw values with neutral names: gray 50 to gray 900, blue 500, spacing 4, radius 12. They describe what the value is, not where it is used. Components should almost never reference them directly.

Semantic tokens

These describe purpose: background primary, surface raised, text secondary, border subtle, accent, danger. Each one points to a primitive. Components reference semantic tokens only.

The payoff is in the mapping. Dark mode becomes a second mapping of the same semantic names to different primitives. A brand refresh becomes a change to a handful of mappings.

Component tokens, when needed

A third layer such as "button primary background" is useful in larger systems or multi-brand products. For a small team I skip it until a real need appears. It doubles the number of names to maintain.

What to tokenize first

  1. Color. The biggest source of inconsistency and the first thing a theme or dark mode will need.
  2. Typography. Font family, size, weight, line height and letter spacing combined into named text styles.
  3. Spacing. A fixed scale. Once people stop inventing values like 13 or 22, layouts calm down immediately.
  4. Radius. Two to four values. Mismatched corner radii are one of the most visible signs of design drift.
  5. Elevation and shadow. A few levels, especially if you have floating elements.
  6. Motion. Durations and easing curves. Often forgotten, but it keeps animations feeling like one product.

Getting tokens into Figma and code

In Figma, variables and modes cover most needs: primitives in one collection, semantic tokens in another with light and dark modes. In code, tokens live in one source file that generates platform outputs: CSS custom properties for web, Swift constants or asset catalog colors for iOS, resources for Android.

The important rule is one source of truth. Either Figma exports to code, or a token file in the repository is the master and Figma mirrors it. Two masters edited by hand will disagree within a month.

For a small team, I keep a single JSON file in the repository as the master, with a short script that writes the platform files. When values change, the designer updates Figma variables in the same pull request review.

Naming that people can use

Good token names are predictable. Someone who knows three names should be able to guess the fourth. I follow a pattern like category, role, variant, state: color text primary, color text secondary, color surface raised, color border focus.

Avoid names that describe appearance at the semantic level. "Color light blue" breaks the moment the brand turns green. "Color accent" survives.

Mistakes that make tokens useless

  • Tokenizing every value ever used. If you turn 37 existing grays into 37 tokens, you have documented the mess, not fixed it. Consolidate first.
  • Components using primitives. Then dark mode needs component-level overrides everywhere, and the semantic layer becomes decoration.
  • Too many semantic tokens. If there are separate tokens for every screen, nobody knows which to pick. Keep the semantic list short enough to memorize.
  • No migration of old code. Tokens defined but never used in shipped screens change nothing. Replace hardcoded values as you touch each screen.
  • Ignoring contrast. Define pairs that work: every text token should pass contrast on the surfaces it is meant for, in both modes.

How I roll tokens into an existing app

For a live app, I do not stop feature work to tokenize everything. I define the token set, add it to the codebase, and then replace hardcoded values screen by screen as features touch them. A simple search for raw hex codes in the code gives a progress number the team can watch shrink.

Tokens for states and interaction

Colors for default states are the easy part. Most drift appears in states: pressed, hovered, focused, disabled, selected. If these are not tokens, each developer picks a slightly different shade or opacity, and the app starts to feel uneven in a way users notice without being able to name it.

I define state tokens as part of the semantic layer: accent pressed, surface selected, border focus, text disabled. For disabled states I prefer specific color tokens over a global opacity, because opacity behaves differently on different backgrounds and in dark mode. Focus deserves special care. A visible focus ring token with enough contrast on every surface is an accessibility requirement for keyboard users on web and for external keyboards on tablets.

The same applies to status colors. Success, warning, danger and info each need a background, a border and a text or icon token that work together, in both light and dark mode. Defining them as sets of three prevents the common mistake of putting red text on a pink background that fails contrast.

Practical takeaway

Build two layers: primitives for raw values and semantic tokens for purpose. Start with color, type and spacing, consolidate before you tokenize, keep one source of truth, and make components reference semantic tokens only. Then migrate shipped screens gradually. The first redesign or dark mode after that will show you what the effort was worth.

Questions I get about this

What is the difference between design tokens and variables?

Figma variables are one way to store tokens in design tools. A token is the named decision itself, which should also exist in code with the same name.

How many color tokens do I need?

For most apps, ten to twenty semantic color tokens cover backgrounds, surfaces, text, borders, accent and status colors. Primitives can be more numerous.

Should tokens live in Figma or in the code repository?

Pick one master. For small teams I prefer a token file in the repository that generates platform outputs, with Figma variables kept in sync.