Skip to content
UIFoundry

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.

By the UIFoundry Editorial Team 6 min read

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.