Quick answer: Design tokens are named design decisions, such as a colour, a size, a radius or a font, stored once and read by both Figma and your code. Change the token and every screen that uses it changes with it, in the design file and in production.
This guide uses the real tokens from the Pixels free Figma UI kit and its React components (@pixelsds/react on npm), so every name and number below is one you can open and check.
What are design tokens?
A design token is a name with a value. Instead of writing #2563eb in forty places, you write color-background-brand-default once, and every button, link and focus ring asks for the brand colour by name.
That sounds like a plain CSS variable, and the output often is one. What makes it a token is that the same name lives in design and in code, and both read the same value. A designer and a developer can point at button/primary/background/default and mean exactly the same thing.
Why use design tokens?
- One change, everywhere. Change a token and every component that uses it follows. No search and replace across a codebase.
- Meaning travels.
color-content-danger-defaulttells a developer when to use it.#d92d20does not. - Themes become possible. A token can hold one value in light mode and another in dark mode. A hex code can only ever be one colour.
What are the three tiers of design tokens?
A flat list of tokens gets messy fast. Most mature design systems, Pixels included, split tokens into three tiers, and each tier points at the one before it.
The three token tiers in the Pixels Figma file: primitives hold raw values, semantic tokens name a job, component tokens tune one part of one component.
| Tier | Example | What it holds | Who changes it |
|---|---|---|---|
| Primitive | color/blue/500 |
A raw value: #2563eb |
The design system team, rarely |
| Semantic | color/background/brand/default |
A job: "the main brand background" | The team, when the brand or a theme changes |
| Component | button/primary/background/default |
One part of one component | A product team tuning a single component |
The rule that keeps the system healthy is short: components read semantic or component tokens, never a primitive and never a hex code. Break it once and dark mode, rebranding and RTL each need a manual fix in that spot.
What are semantic tokens?
Semantic tokens name the purpose of a value rather than the value itself. color/content/danger/default is semantic; color/red/600 is a primitive. Semantic tokens are what let one component look right in light mode, dark mode and every brand theme.
How do design tokens work in Figma?
In Figma, design tokens are variables. Variables live in collections, and a collection can have modes: one value per mode. Light and Dark are two modes of the same collection, so a component bound to color/background/brand/default switches automatically when the frame switches mode.
The Primitives colour ramps in the Pixels Figma file, each with its hex value and APCA contrast score.
The Pixels Figma file has seven collections, 942 variables in total. Each one becomes a block of CSS:
| Collection | Modes | Tokens | Purpose |
|---|---|---|---|
| Primitives | Default | 303 | Raw palette, sizes, radius, blur and type values |
| Brand | Pixels, Mono | 11 | The brand ramp, pointing at Blue by default |
| Color | Light, Dark, Light · Mono, Dark · Mono | 139 | Semantic colours for content, background, border and surface |
| Dimension | Desktop, Tablet, Mobile | 127 | Responsive type, spacing, radius and layout |
| Locale | en · LTR, ar · RTL | 53 | Direction, font family and line heights |
| Density | Default, Compact, Comfortable | 10 | Control heights, padding and gaps |
| Component | Default | 299 | Per-component tokens like button/md/radius |
Two habits make Figma variables far easier to turn into code:
- Scope every variable. A text colour that only shows up in the text colour picker cannot be put on a background by mistake.
- Name with slashes, the same way you will name in code.
color/background/brand/defaultbecomes--px-color-background-brand-defaultwith no lookup table in between.
You can open all 942 variables yourself in the free Pixels Figma kit.
How do you turn Figma variables into CSS and React?
The handoff is a build step, not a person. Pixels exports the variables to one JSON file, and a script writes each token and mode as a CSS custom property. Slashes become dashes and every name gets a --px- prefix:
--px-color-blue-500: #2563eb; /* Primitive */
--px-color-brand-500: var(--px-color-blue-500); /* Brand */
--px-color-background-brand-default: var(--px-color-brand-500); /* Semantic */
--px-button-primary-background-default: var(--px-color-background-brand-default); /* Component */
Only the first line holds a real colour. Everything after it is a reference, which is why changing one primitive or one brand ramp ripples through the whole system.
React components then read tokens and nothing else. Here is the size map from the Pixels Button, which uses Tailwind v4 classes that point straight at the Figma component tokens:
const sizes = {
md: 'h-[var(--px-button-md-height)] rounded-[var(--px-button-md-radius)] px-[var(--px-button-md-padding-x)] text-sm [&_svg]:size-[var(--px-button-md-icon)]',
sm: 'h-[var(--px-button-sm-height)] rounded-[var(--px-button-sm-radius)] px-[var(--px-button-sm-padding-x)] text-sm [&_svg]:size-[var(--px-button-sm-icon)]',
xs: 'h-[var(--px-button-xs-height)] rounded-[var(--px-button-xs-radius)] px-[var(--px-button-xs-padding-x)] text-[13px] [&_svg]:size-[var(--px-button-xs-icon)]',
};
Because the component holds no values of its own, a designer who changes button/md/radius in Figma changes the React button on the next build. The full component source is in the free React kit on GitHub.
How do design tokens power dark mode, brand colours, density and RTL?
This is where tokens earn their keep. Every theme below is the same React components and the same markup. Only one attribute on <html> or one brand ramp changes.
Watch the demo on the original post: one set of real Pixels components switching from Light to Dark, to a new brand colour, to Compact density and to Arabic right to left, with no component code changed.
<html data-px-theme="dark"> <!-- Color collection: Dark mode -->
<html data-px-brand="mono"> <!-- Brand collection: Mono -->
<html data-px-density="compact"> <!-- Density collection: 32px controls -->
<html dir="rtl" lang="ar"> <!-- Locale collection: Arabic, mirrored -->
A new brand colour is just as small. Override the brand ramp and every button, link, badge, switch and focus ring follows:
:root {
--px-color-brand-500: #db2777;
--px-color-brand-600: #be185d;
--px-color-brand-700: #9d174d;
}
Four looks from one set of tokens: Light, Dark, a custom pink brand and Arabic right to left.
How should you name design tokens?
Token names outlive designs. A good name still makes sense after a rebrand.
- Name the job, not the look.
color/content/danger/default, notcolor/red-text. The danger colour may not stay red. - Use one order everywhere: category, then role, then variant, then state.
color/background/brand/hoverreads the same way ascolor/border/neutral/default. - Keep states in the name.
default,hover,pressed,disabledandfocusshould be tokens, so a hover colour is a decision, not a guess. - Keep primitives boring.
blue/500is fine. The meaning lives one tier up. - Never encode a mode in a name.
background-darkbreaks the moment you add a high-contrast theme. Use modes for that.
What is the W3C design tokens standard?
Tokens now have a shared file format. The Design Tokens Community Group published the first stable version of its specification (2025.10) on 28 October 2025, with support for themes, aliases and modern colour spaces. Tools such as Style Dictionary, Tokens Studio and Terrazzo are reference implementations.
In that format a token is a JSON object with $type and $value, and an alias uses curly braces:
{
"color": {
"blue": {
"500": {
"$type": "color",
"$value": { "colorSpace": "srgb", "components": [0.145, 0.388, 0.922], "hex": "#2563eb" }
}
},
"background": {
"brand": { "default": { "$type": "color", "$value": "{color.blue.500}" } }
}
}
}
The spec recommends the .tokens or .tokens.json file extension. If your tokens already follow the three tiers and slash names above, moving to the standard format is a conversion script, not a redesign. See the Format module for the details.
What are the most common design token mistakes?
- Hex codes inside components. One hard-coded colour is one place dark mode will be wrong. Search for
#in your component code now and then. - Too many primitives in the picker. If designers can pick
blue/500directly, they will. Hide primitives from publishing and scope them so only semantic tokens show up. - A semantic token for every screen.
checkout-header-bgis a component decision wearing a semantic name. Keep the semantic tier small and reusable. - Tokens that never reach code. If the export is manual, it will drift. Make the Figma-to-CSS step part of the build.
- No owner. Someone has to review new tokens, or the list doubles in a year.
Design tokens checklist
- Three tiers: primitive, semantic, component
- Components only read semantic or component tokens
- Light and Dark are modes of one Color collection, not two sets of tokens
- Names use slashes in Figma and map one to one to CSS
- The Figma-to-code export runs as part of the build
- Brand, density and direction each change from one place
Frequently asked questions
What is a design token in simple terms?
A design token is a named value, like color-background-brand-default = #2563eb, that designers and developers share. It replaces hard-coded values so a single change updates every design and every screen.
Are design tokens the same as CSS variables?
No, but CSS variables are the most common output. A token is the design decision with a shared name. The same token can also become a Swift constant, an Android resource or a Tailwind theme value.
Do I need a plugin to use design tokens in Figma?
Not any more. Figma variables, collections and modes cover primitives, semantic tokens and themes natively. Plugins are still useful for exporting in a specific format.
What is Style Dictionary?
Style Dictionary is an open-source build tool that reads design token files and outputs them for each platform, such as CSS variables, iOS and Android. It is one of the reference implementations of the W3C design tokens format.
How many design tokens does a design system need?
Fewer than you think at the semantic tier, and as many primitives as your palette needs. Pixels has 139 semantic colour tokens and 303 primitives. A small product can start with a few dozen semantic tokens and grow.
Can design tokens handle right-to-left languages?
Partly. Tokens can switch the font, line height and direction for Arabic or Hebrew. The layout itself flips only if components use logical CSS properties, so plan for both.
Free resources: see these tokens in action
Every token in this guide is in the free Pixels kits:
- 🎨 Free Figma UI kit: all seven collections, modes and scoped variables.
- 💻 Free React kit on GitHub: components that read only tokens.
- 📦
@pixelsds/reacton npm:npm install @pixelsds/reactand switch themes with one attribute. - 📖 Browse the tokens in the Pixels docs or switch themes live in the Storybook.