Design tokens: what they are and how to use them

The foundational layer connecting design decisions to code on any platform

9 min

Design tokens are the invisible foundation of every well-built design system. They represent the most atomic design decisions — colours, typography, spacing, shadows — in a platform-agnostic format that can be consumed from CSS, iOS, Android or any other environment.

When a team works without tokens, every developer interprets design values in their own way: one uses #333 for body text, another uses #2D2D2D, another rgb(50,50,50). Tokens eliminate this ambiguity by acting as the single source of truth for visual decisions.

What are design tokens?

A design token is a named variable that stores a design value. Instead of writing #1A73E8 directly in your CSS or in Figma, you define a token called color-primary whose value is #1A73E8. That token becomes the contract between design and development.

The concept was popularised by Salesforce with their Lightning Design System and has since been adopted by virtually every major design system. In 2024, the W3C Community Group published the Design Tokens Format Module specification, standardising the way tokens are defined in JSON.

Types of design tokens

Tokens are organised into categories that reflect the different dimensions of visual design. Each category has its own conventions and scales.

  • Colour: primitive palette (blue-500, gray-100) and semantic (color-primary, color-text-secondary, color-surface-error)
  • Typography: font-family, font-size, font-weight, line-height, letter-spacing — often grouped into composite tokens (typography-heading-lg)
  • Spacing: modular scale (space-1 = 4px, space-2 = 8px, space-4 = 16px) defining margins, paddings and gaps
  • Shadows: box-shadow values with elevation levels (shadow-sm, shadow-md, shadow-lg)
  • Borders: border-radius, border-width, border-color across different contexts
  • Motion: duration and easing for animations (duration-fast = 150ms, easing-standard = cubic-bezier(0.4, 0, 0.2, 1))

Primitive vs semantic vs component tokens

The most effective token architecture uses three tiers. Primitives define raw values (blue-600 = #1A73E8). Semantics assign intent (color-primary = blue-600). Component tokens apply values to a specific context (button-bg-primary = color-primary).

This hierarchy allows you to change a brand colour by updating a single semantic token instead of editing dozens of components. It is also the key to supporting dark mode: you redefine the semantic tokens for the dark theme and every component adapts automatically.

Token naming conventions

Good naming is the difference between an intuitive token system and one nobody understands. The most widespread convention uses kebab-case with a category-property-variant-state structure. For example: color-text-primary, spacing-inline-md, shadow-elevation-high.

Avoid names that describe the value instead of the intent. color-blue-500 is a valid primitive token, but as a semantic token it is fragile: if the brand shifts from blue to green, the name no longer makes sense. Use color-brand-primary instead.

  • Structure: category-property-variant-state (e.g. color-bg-surface-hover)
  • Use kebab-case in definitions; each platform transforms to its native format
  • Name by intent, not by value: color-danger instead of color-red
  • Be consistent: if you use sm/md/lg for sizing, apply it across all categories

Tools for managing design tokens

The token workflow involves defining them in a centralised format (usually JSON or YAML), transforming them to each platform’s format (CSS custom properties, SCSS, Swift, Kotlin, XML) and syncing them between design tools and code.

  • Style Dictionary (Amazon): the most established tool for transforming tokens to multiple platforms from a central JSON source
  • Tokens Studio for Figma: a plugin that lets you define and manage tokens directly in Figma, with Git repository sync
  • Supernova: a platform that connects Figma with code, generating documentation and tokens automatically
  • Theo (Salesforce): a lightweight token transformer, ideal for projects already in the Salesforce ecosystem
  • Design Tokens Format Module (W3C): a standard specification that tools like Style Dictionary are progressively adopting

Tokens in multi-platform projects

The real power of design tokens emerges in projects spanning multiple platforms. You define tokens once in a neutral format and automatically transform them to CSS custom properties for the web, UIColor for iOS, ColorRes for Android, and whatever other format you need.

This ensures that a brand colour change propagates to every platform with a single commit. Without tokens, the same change would require coordinating manual updates across each team and each repository, with the inherent risk of inconsistencies.

Common mistakes with design tokens

The most common mistake is creating too many tokens too early. A system with 500 tokens from day one is unmanageable. Start with the tokens that cover 80% of your use cases and only add new ones when there is a real, recurring need.

Another frequent error is failing to distinguish between primitive and semantic tokens. If developers reference blue-500 directly instead of color-primary, you lose the ability to make global changes. Establish this rule from day one and enforce it with linting.

Key Takeaways

  • Design tokens are variables that store design decisions in a platform-agnostic way
  • Organise tokens into three tiers: primitive, semantic and component
  • Good intent-based naming (not value-based) is key to maintainability
  • Style Dictionary and Tokens Studio are the reference tools in the ecosystem
  • In multi-platform projects, tokens ensure consistency with a single change

Need to implement design tokens in your system?

We define the token architecture, set up the transformation pipeline and help you integrate tokens into your design and development workflow.