Design tokens are the atomic values of your design system—colors, typography, spacing, and more. This guide shows how to implement and scale design tokens effectively.
What Are Design Tokens?#
Design tokens are named entities storing visual design attributes:
Token Architecture#
Three-Tier Token System#
┌─────────────────────────────────────────────────────────┐
│ SEMANTIC TOKENS (Component-level) │
│ button-primary-background → color-brand-500 │
│ card-shadow → shadow-md │
└─────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────┐
│ ALIAS TOKENS (Theme-level) │
│ color-brand-500 → color-blue-500 │
│ color-text-primary → color-gray-900 │
└─────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────┐
│ PRIMITIVE TOKENS (Raw values) │
│ color-blue-500 → #3b82f6 │
│ spacing-4 → 16px │
└─────────────────────────────────────────────────────────┘
Token File Structure#
tokens/
├── primitives/
│ ├── colors.json
│ ├── typography.json
│ ├── spacing.json
│ └── shadows.json
├── semantic/
│ ├── light.json
│ └── dark.json
├── components/
│ ├── button.json
│ ├── input.json
│ └── card.json
└── index.js
Defining Tokens#
Color Tokens#
Semantic Tokens with References#
Typography Tokens#
Component Tokens#
Transforming Tokens#
Using Style Dictionary#
Generated CSS Output#
Integration with Tailwind#
Extending Tailwind Config#
Using in Components#
Theme Switching#
CSS Variables Approach#
System Preference Detection#
Syncing with Figma#
Tokens Studio Plugin#
Automated Sync Workflow#
Best Practices#
1. Naming Conventions#
2. Documentation#
3. Versioning#
Testing Tokens#
Conclusion#
Design tokens bridge the gap between design and development. Start with primitives, build semantic layers, and use tools like Style Dictionary to transform tokens for each platform. Consistent tokens enable scalable design systems that maintain visual coherence across products.