No history yet

Design Token Foundations

Beyond Hard-Coded Values

In any digital product, consistency is key. But maintaining it across different platforms and teams is a challenge. When developers hard-code values like #3B82F6 for a button or 16px for body text directly into the codebase, you create isolated, inflexible instances. Changing a primary color means hunting down every single hex code and replacing it. This process is slow, error-prone, and doesn't scale.

Design tokens solve this problem by abstracting these values into a centralized system. Instead of using a raw hex code, you use a named variable, or token, like color-primary-action. This token acts as a single source of truth. When the primary action color needs to change, you update the token's value in one place, and that change propagates everywhere it's used, from design files to the final product.

Design tokens function as the atoms of the visual system, serving as the “DNA” that shapes every interface.

This approach creates a shared language between designers and developers, ensuring everyone is building from the same set of rules. It moves design decisions from static, one-off choices into a dynamic, manageable system.

A Three-Tier Architecture

Not all tokens are created equal. A robust design system organizes them into a tiered structure to balance flexibility with clarity. The most common model uses three layers: primitive, semantic, and component-specific tokens. Each layer builds upon the one before it, adding more context and specificity.

This structure allows you to make changes at the right level of abstraction. A global color palette update happens at the primitive level, while a rebranding of what 'success' means happens at the semantic level.

Building the Foundation

Tier 1: Primitive Tokens

Primitives are the raw, context-agnostic values in your system. Think of them as your entire collection of paint colors or a complete set of drill bits. They have names that describe their value, not their purpose, such as color-blue-500 or space-4. They are exhaustive but don't carry any meaning about where or how they should be used.

Keeping primitives separate allows designers and developers to see the full range of available options. This layer rarely changes, forming the stable base of the system.

{
  "color": {
    "blue": {
      "500": "#3B82F6",
      "600": "#2563EB"
    }
  },
  "size": {
    "font": {
      "base": "16px",
      "lg": "18px"
    }
  }
}

Tier 2: Semantic Tokens

This is where intent comes in. Semantic tokens, also called alias tokens, give purpose to primitive values. They answer the question, "What is this for?" For example, color-action-primary might point to color-blue-500. Another token, text-color-link, could also point to color-blue-500.

The power of this layer becomes clear when you need to make a strategic design change. If your brand's primary color changes from blue to purple, you only need to update the color-action-primary token to point to a primitive purple value. Every element using that semantic token will update automatically, without anyone needing to know the specific hex code.

{
  "color": {
    "background": {
      "primary": "{color.blue.500}"
    },
    "text": {
      "interactive": "{color.blue.600}"
    }
  },
  "font": {
    "size": {
      "body": "{size.font.base}"
    }
  }
}

Good semantic naming is crucial. Names should be generic enough to be reusable but specific enough to be understood. A common convention is [category]-[property]-[concept]-[variant], like color-background-success-default.

Tier 3: Component-Specific Tokens

Sometimes, a component has a unique design need that isn't covered by general semantic tokens. Component-specific tokens provide that final layer of control. These tokens are scoped to a single component, like a button or an input field.

For instance, a token named button-primary-background-color would likely reference the semantic token color-action-primary. This makes the button's design explicit and easy to override if needed for a specific theme or state, without affecting other elements that use the same semantic token.

{
  "button": {
    "primary": {
      "background-color": "{color.background.primary}",
      "text-color": "{color.text.interactive}"
    }
  }
}

From Design to Code

The true value of design tokens is realized when they bridge the gap between design tools and the final coded product. This is often handled by a dedicated tool that automates the process.

One of the most popular tools is Style Dictionary. It takes a structured JSON file of your design tokens as input and transforms it into any format you need: CSS custom properties, SASS variables, iOS and Android specific formats, and more. This automation ensures that when a token is updated in the central JSON file, the changes are consistently applied across all platforms.

Designers typically manage tokens within their design tool, like Figma, using plugins. When changes are made, the token JSON file is exported and fed into the build pipeline. Style Dictionary then runs its transformations, and developers can immediately use the updated, correctly formatted variables in their code.

This workflow eliminates the manual, error-prone process of translating design specs into code. It creates a seamless, automated system where design intent is preserved perfectly across platforms.

Quiz Questions 1/6

What is the primary problem that design tokens are designed to solve?

Quiz Questions 2/6

A token named color-feedback-success that points to the primitive value green-400 is an example of which type of token?

By structuring design decisions into this three-tiered token system, teams can build UIs that are more consistent, maintainable, and scalable.