Design and development
Design Token Architecture: Bridging Figma Variables and CSS Custom Properties
Architect a production design token pipeline. Learn token naming conventions (DTCG standard), JSON schema structures, and Style Dictionary automation.
BLUF (Bottom Line Up Front)
Design tokens are the foundational atomics of scalable software design systems, encapsulating color hexes, typography scales, spacing values, and motion curves into platform-agnostic key-value pairs. By adopting the Design Tokens Community Group (DTCG) specification and tools like Style Dictionary, engineering teams automate the synchronization of Figma Variables directly into CSS custom properties, iOS Swift, and Android XML.
1. The Token Taxonomy Hierarchy
A robust token architecture separates raw choices from operational context through three layers:
+-------------------------------------------------------------+
| Design Token Taxonomy Layers |
+-------------------------------------------------------------+
| Layer 1: Global / Option Tokens |
| -> Raw values: { "blue-600": "#2563eb", "space-4": "16px" }
| |
| Layer 2: Semantic / Alias Tokens |
| -> Design intent: { "color-action-primary": "{blue-600}" }|
| |
| Layer 3: Component Tokens |
| -> Specific scope: { "button-primary-bg": "{action-pri}" }|
+-------------------------------------------------------------+
2. DTCG-Compliant JSON Token Specification
The W3C Design Tokens Community Group standardizes token syntax across industry tooling:
{
"color": {
"brand": {
"primary": {
"$value": "#4f46e5",
"$type": "color",
"$description": "Primary action color for interactive elements"
}
}
},
"spacing": {
"md": {
"$value": "1rem",
"$type": "dimension"
}
}
}
3. Automating Figma to Code with Style Dictionary
Style Dictionary transforms raw token JSON files exported from Figma into production code targets:
// build-tokens.js
const StyleDictionary = require('style-dictionary');
StyleDictionary.registerFormat({
name: 'css/variables',
formatter: function({ dictionary }) {
return `:root {
` +
dictionary.allTokens.map(token => ` --${token.name}: ${token.value};`).join('
') +
`
}`;
}
});
StyleDictionary.extend({
source: ['tokens/**/*.json'],
platforms: {
css: {
transformGroup: 'css',
buildPath: 'src/styles/',
files: [{ destination: 'tokens.css', format: 'css/variables' }]
}
}
}).buildAllPlatforms();
4. Avoiding Token Sprawl
The most common failure mode in enterprise design systems is ‘Token Explosion’—creating 3,000 hyper-specific tokens that no developer can remember.
Governance Rules:
- Enforce Token Quotas: Limit semantic color tokens to under 40 core roles across light and dark modes.
- Strict Linting: Deploy ESLint plugins (
eslint-plugin-tailwindcss) or Stylelint rules that flag hardcoded hex values in code reviews.
Frequently Asked Questions
Can design tokens store responsive breakpoint values?
Yes. Tokens frequently define viewport boundaries (token.breakpoint.md: 768px) which compile into CSS media query mixins.
What is the difference between CSS custom properties and design tokens?
CSS custom properties are the browser runtime implementation mechanism; design tokens are the abstract, cross-platform design data stored in JSON.
Sources
Frequently asked questions
- How can developers test this design technique?
- Open browser developer tools, enable the CSS Grid overlay, and inspect track sizes as you resize the viewport.
- Does this layout technique pass accessibility audits?
- Yes. By maintaining semantic HTML document structure, screen readers process DOM nodes in order regardless of visual grid track placement.
About the author
Written by the UIFoundry Editorial Team, which researches and maintains every guide on this site. Read more about our editorial standards or contact us with corrections.
Keep reading
WCAG 2.1 & 2.2 Color Contrast: The Complete Frontend Accessibility Guide
Understand WCAG color contrast standards. Master AA vs AAA requirements, non-text contrast rules for icons and borders, and modern APCA alternatives.
Read the guide →Architecting Tailwind CSS Design Systems: Semantic Tokens, CSS Variables, and Dark Mode
How to build maintainable, accessible color design systems in Tailwind CSS using CSS custom properties, alpha opacity modifiers, and semantic tokens.
Read the guide →System Font Stacks for Web Performance: Zero CLS and Instant Text Rendering
Why high-traffic websites are abandoning external Google Fonts in favor of native system font stacks. Eliminate font-display FOIT, CLS shifts, and HTTP requests.
Read the guide →