⚡
EINCODE
>Home>Projects>Workbench>Blog
GitHubTwitterLinkedIn
status: building
>Home>Projects>Workbench>Blog
status: building

Connect

Let's build something together

Always interested in collaborations, interesting problems, and conversations about code, design, and everything in between.

send a signal→

Find me elsewhere

GitHub
@ehsanghaffar
Twitter
@ehsanghaffar
LinkedIn
/in/ehsanghaffar
Email
hello@ehsanghaffar.dev
Forged with& code

© 2026 EINCODE — All experiments reserved

back to blog
frontend

Building a Design Token System

Creating a scalable design token architecture that works across platforms. From CSS variables to Figma tokens and everything in between.

EG

Ehsan Ghaffar

2024-08-229 min read
#design-systems#css#tokens

What Are Design Tokens?

Design tokens are the atomic values of your design system—colors, spacing, typography, shadows. They're platform-agnostic and enable consistency across web, mobile, and design tools.

Token Hierarchy

A well-structured token system has three layers:

1. Primitive Tokens (Raw Values)

{
  "blue-500": "#3b82f6",
  "space-4": "16px",
  "font-size-lg": "18px"
}

2. Semantic Tokens (Purpose)

{
  "color-primary": "{blue-500}",
  "spacing-component": "{space-4}",
  "text-body": "{font-size-lg}"
}

3. Component Tokens (Specific Use)

{
  "button-background": "{color-primary}",
  "button-padding": "{spacing-component}",
  "button-font-size": "{text-body}"
}

Implementation in CSS

:root {
  /* Primitives */
  --blue-500: #3b82f6;
 
  /* Semantic */
  --color-primary: var(--blue-500);
 
  /* Component */
  --button-bg: var(--color-primary);
}
 
.button {
  background: var(--button-bg);
}

Syncing with Figma

Use the Tokens Studio plugin to export tokens:

  1. Define tokens in Figma using Tokens Studio
  2. Export as JSON
  3. Transform with Style Dictionary
  4. Generate platform-specific outputs

Conclusion

Design tokens bridge the gap between design and development. Invest in the foundation, and your design system scales effortlessly.

share
share:
[RELATED_POSTS]

Continue Reading

frontend

Next.js 16 + Tailwind CSS v4 Migration Guide

Exploring the new features in Next.js 16 and migrating to Tailwind CSS v4's new configuration system. A practical guide to modern frontend tooling.

2024-12-10•10 min read