All articles
Yubild

Design tokens explained: the single source of truth between design and code

Design tokens turn visual decisions into named, reusable values that designers and developers share. What they are, how to name them, and how to keep them from becoming another file nobody updates.

Chérif Sikirou

3 min read

Color swatches and palettes spread on a designer's desk

Ask a designer and a developer what "primary green" means and you may get two different answers. One points to a swatch in Figma. The other points to a hex value hidden in a CSS file. Both are right, and that is exactly the problem.

Design tokens exist to remove that ambiguity. They give every visual decision a name, a value and a single home.

What a design token actually is#

A design token is a named value that stores a design decision. A color, a spacing step, a font size, a radius, a shadow, a duration. Instead of writing #0F766E in twenty places, you write color.brand.primary once and reference it everywhere.

The value can change. The name, and the intent behind it, stays.

That small shift has large consequences:

  • Designers stop redrawing the same decision in every file.
  • Developers stop guessing values from screenshots.
  • Product teams can change a brand color or a spacing scale without a hunt across the codebase.

The three layers that make tokens scale#

Most mature systems organise tokens in three layers. You do not need all three on day one, but knowing them avoids painful renames later.

LayerExampleRole
Primitivegreen.600 = #0F766EThe raw palette. No meaning, just values.
Semanticcolor.action.primary = green.600The intent. What the value is used for.
Componentbutton.primary.background = color.action.primaryThe local decision for one component.

Components should consume semantic tokens, never primitives directly. The day you introduce a dark theme or a second brand, you remap the semantic layer and every component follows.

A designer sketching an interface on a tablet

Naming: boring is good#

Token names are an API. People will type them thousands of times, and tools will parse them. A few rules keep them readable:

  1. Go from general to specific. color.text.muted reads better and sorts better than mutedTextColor.
  2. Name the intent, not the look. color.feedback.danger survives a rebrand. color.red does not.
  3. Keep one vocabulary. If you say background in one place, do not say bg or surface for the same thing elsewhere.
  4. Avoid numbers that hide meaning in the semantic layer. Numbers belong to scales in the primitive layer.

Where tokens usually break#

Tokens rarely fail because of the format. They fail because of the workflow around them.

The classic pattern looks like this. Tokens are defined in a design tool, exported once into a JSON file, copied into the codebase, and then the two drift apart. A designer tweaks a value, a developer hardcodes a fix, and three months later the "single source of truth" has two sources and no truth.

To avoid that, a token system needs three things:

  • One owner of the source. Pick where the canonical values live and make every other place a generated output.
  • A standard format. The W3C Design Tokens Community Group format (DTCG) gives you a shared JSON structure that tools can read without custom glue.
  • Automated delivery. Changes should travel from the source to the code as a reviewable pull request, not as a copy and paste.

How we approach it at Yubild#

Yubild was built around that last point. Tokens live in one place, in the DTCG format, and every change can be exported to CSS variables, Tailwind or JSON, or opened as a pull request on the repository that consumes them. Designers keep working in Figma, developers keep working in their codebase, and the tokens move between the two with a history of who changed what.

The goal is not another tool to maintain. It is to make the right path the easy one.

A simple way to start#

If your product has no tokens today, do not try to tokenise everything at once.

  1. Start with color, spacing and typography. They cover most of the visual surface.
  2. Extract the values already used in your code, then merge the near duplicates. Five slightly different greys are usually one.
  3. Define the semantic layer for the most common intents: text, background, border, action, feedback.
  4. Replace hardcoded values in your most used components first. The rest will follow.

Tokens are not a design project or a front end project. They are a shared language. The sooner both sides speak it, the less time your team spends translating.

  • #design-tokens
  • #design-systems
  • #front-end
Share LinkedIn Post

Turn your design decisions into production tokens

Build, govern and ship your design system with Yubild.

Start for free