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.
2 December 2026
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.

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.
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.
I use two layers in almost every project, sometimes three.
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.
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.
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.
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.
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.
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.
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.
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.
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.
For most apps, ten to twenty semantic color tokens cover backgrounds, surfaces, text, borders, accent and status colors. Primitives can be more numerous.
Pick one master. For small teams I prefer a token file in the repository that generates platform outputs, with Figma variables kept in sync.