Implementing Design Tokens for Web Application Design Systems
In a project with 5 developers and 2 designers, the environment is chaos. One uses #1A73E8, another uses #1565C0, while in Figma the color is called Blue/600. Theming leads to duplicated styles — each new design requires rewriting CSS. The team spends up to 20 hours per week aligning colors and spacing, resulting in 100+ style bugs per month. The solution is implementing Design Tokens: a single source of truth for colors, spacing, typography, shadows, and animations. We have been through this in 30+ projects and know how to avoid the pitfalls. Experience shows that with tokens, change velocity increases 3x and bug count drops by 70%.
Why Design Tokens Are Not Just CSS Custom Properties
Directly replacing #1A73E8 with --color-primary is a variable, not a token. A token carries semantics: --color-action-primary-default, --color-action-primary-hover. The difference is fundamental: when changing the brand color, you change one value in one place, not search all occurrences of 'primary blue' across the codebase. Without tokens, a team of 5 people spends up to 20% of their time on styling: the designer changes Blue/600 in Figma, the developer doesn't know that #1D4ED8 is already used in 12 places under different hex values. Theming requires duplicating styles instead of switching a set of variables. According to Amazon Style Dictionary, tokens reduce overhead by 40%.
How to Implement Design Tokens in a Design System
Implementation starts with an audit of current styles and Figma. Then we design a three-level token model: primitive, semantic, and component. Primitive tokens store raw values without context: color.blue.500: #3B82F6. Semantic tokens attach meaning: color.action.primary.default: {color.blue.500}. Component tokens define specific components: button.background: {color.action.primary.default}. This allows global design changes by modifying one primitive value and makes theming as simple as switching files.
The Three-Level Model Solves Duplication
If you need to change the blue shade, you only update the primitive token, and all components automatically get the new color. Without this model, you would have to edit every button, card, and link individually. This is 10x more efficient than manual CSS updates.
| Problem | Token Solution | Result |
|---|---|---|
| Different values for the same color | Centralized storage | One change for all |
| Theming difficulties | Semantic tokens per theme | Switch CSS files |
| Figma-code mismatch | Bidirectional sync | Single source of truth |
Integrating Tokens with Figma
We use the Tokens Studio plugin for bidirectional sync with GitHub. Workflow:
- Designer changes a token in Figma
- Plugin pushes the change to branch
tokens/update-blue-palette - CI runs Style Dictionary, generates CSS/JS
- PR with updated artifacts — code review and merge
Configuring Tailwind for Tokens
In Tailwind 4, tokens are plugged via the @theme directive:
@theme {
--color-primary: var(--color-action-primary-default);
--radius-button: var(--button-radius);
}
Versioning Tokens
Tokens are part of the codebase. We store them in the design system monorepo and publish as npm package @company/[email protected]. Semantic versioning is critical: renaming a token is a breaking change (major), adding is minor, fixing a value is patch or minor depending on context. We write the changelog readable for designers.
Example token file structure
tokens/
primitive/
color.json
spacing.json
typography.json
semantic/
color.json
spacing.json
component/
button.json
card.json
Transformation Tools
Style Dictionary from Amazon is the de facto standard. Here's a typical configuration:
// config.js
module.exports = {
source: ['tokens/**/*.json'],
platforms: {
css: {
transformGroup: 'css',
buildPath: 'dist/css/',
files: [{
destination: 'tokens.css',
format: 'css/variables',
options: { outputReferences: true }
}]
},
js: {
transformGroup: 'js',
buildPath: 'dist/js/',
files: [{
destination: 'tokens.js',
format: 'javascript/es6'
}]
}
}
};
Running npx style-dictionary build --config config.js generates CSS and JS. CSS output:
:root {
--color-blue-500: #3B82F6;
--color-action-primary-default: var(--color-blue-500);
--button-background: var(--color-action-primary-default);
}
A dark theme can be added as a separate set of semantic tokens and compiled into tokens-dark.css.
Work Stages
| Stage | Duration | Result |
|---|---|---|
| Audit existing styles and Figma | 1–2 days | Report on inconsistencies |
| Design primitive and semantic tokens | 2–3 days | JSON token schema |
| Set up Style Dictionary and compilation | 2–3 days | CSS/JS/SCSS artifacts |
| Integrate into project | 2–4 days | Merge request with tokens |
| Figma integration (optional) | 3–5 days | Bidirectional sync |
What's Included
We conduct an audit of current styles and Figma library, design a three-level token scheme, configure compilation via Style Dictionary, and integrate into code (CSS, JS, Tailwind). We prepare documentation on token usage and train the team (1–2 hours). All work comes with a 3-month warranty on token functionality.
Typical mistakes during implementation: do not mix primitive and semantic tokens in one file; do not use tokens for non-design decisions (e.g., modal z-index); always add fallbacks for older browsers; version tokens with SemVer.
Contact us for a preliminary project estimate — we'll determine timelines in 1 day. Get a free engineer consultation. Order design token implementation and free your team from style chaos.







