skip to content

Why does a design system put a semantic token layer between raw primitive values and components, and what does that extra layer cost?

level: middleimportance: must knowfreq 60%

answer

  1. change the decision, not every use
  2. intent recorded where it is used
  3. same value, different purposes
  4. indirection and granularity drift

basics

~20 s

The semantic layer records intent: components ask for the primary-action color, not a specific blue, so the system changes a decision by re-pointing one alias. The cost is an extra hop to debug, more names to learn and a vocabulary to keep right-sized.

solid answer

~40 s

Without a semantic layer, components reference raw options such as the brand blue, and the fact that a given blue means "primary action" lives only in people's heads. The semantic layer writes that intent down: `color.action.primary` aliases the blue, and components reference the alias. Three things follow. A decision changes in one place, because re-pointing the alias moves every primary action and nothing else. Themes and brands get a hook, since they can supply values for purposes without editing components. And the vocabulary narrows choices, because teams pick from purposes rather than from a palette of forty blues. The cost is real: one more hop to read and debug, more names to learn, arguments over which token applies, and a tier that stops working if it grows too vague or too specific.

go deeper

for a junior

Know that components reference purposes, not raw colors, and that this lets the system change a decision in one place.

for a middle

Explain the mechanism with an example where one value serves several purposes, and name the costs: an extra hop, more names, choice debates, granularity drift.

for a senior

Show how you keep the tier healthy across teams: the change-together test for sharing tokens, usage review, and guidance that ends debates about which token applies.

for a principal

Argue how thick the layer should be for this organization, weighing products, platforms and brands served against the cost of vocabulary every team must learn.

## The problem a flat token list leaves unsolved Imagine a ride-hailing driver app whose design system has only one tier: a palette of **primitive** tokens such as `color.blue.600`, with components referencing them directly. The brand blue appears on the accept-ride button, on text links to trip details, on the selected tab of the earnings screen and on the route line drawn on the map. Every one of those references says the same thing — use `color.blue.600` — even though the four uses mean four different things. Now the brand team wants primary actions to stand out more and asks for a different color on buttons only. The system cannot express the request. Changing `color.blue.600` recolors all four uses, including the map. Leaving it alone means someone must find every place where the blue *means* primary action and edit it by hand, across the web app and the native apps. The knowledge of which blue meant what lived only in people's heads. ## What the semantic layer buys A **semantic token** names a purpose and **aliases** a primitive: `color.action.primary` points at `color.blue.600`, and so, separately, might `color.text.link`. Components reference the semantic token. That one extra hop pays for several things: - **One place to change a decision.** Re-pointing `color.action.primary` moves every primary action at once and leaves links and the map alone. - **Intent recorded at the point of use.** Someone reading the accept-ride button's design or code sees "primary action", not a color, and knows what should happen when the system changes. - **A hook for themes and brands.** Because components ask for purposes, a theme or a second brand can supply different values for those purposes without editing any component. How modes and brands actually remap values is a theming decision built on top of this tier. - **A smaller, safer vocabulary.** A team picks from a few dozen purposes rather than a palette of forty blues, which cuts near-duplicate choices. - **A shared language across platforms and the design editor.** Designers and engineers on every platform name the same decision the same way, which makes review and handoff concrete. - **Auditable usage.** It becomes possible to ask where the primary-action color is used and get a real answer. ## What it costs The semantic layer is a deliberate indirection, and indirection is never free. | Cost | What it looks like | Mitigation | |---|---|---| | An extra hop | Debugging "why is this blue?" means following an alias | Docs or tooling that show the resolved chain next to each token | | More names to learn | New engineers must learn the semantic vocabulary | A small, well-documented set with examples | | Choice arguments | Teams debate whether a banner's button is primary or secondary | Usage guidance attached to each token | | Granularity drift | The tier grows vague, or explodes into hundreds of names | Periodic review of how each token is actually used | ## Getting the granularity right The layer only works if its tokens name purposes at a useful altitude. - **Too vague**: one `color.primary` used for buttons, links, focus indicators and highlights recreates the original problem one level up — changing it moves everything. - **Too specific**: a token per element per screen, such as one for the earnings header's left icon, stops sharing decisions at all. It is really a component tier wearing the wrong name, and it multiplies the names to learn. - **About right**: purposes that recur across the product and could plausibly change independently — actions, text emphasis levels, surfaces, borders, status colors, selection. A useful test for two uses that share a value today: *if one changed, should the other change too?* If yes, they can share a semantic token. If not, they deserve separate tokens, even while both still point at the same primitive. ## When a thin layer is enough The semantic tier is not an all-or-nothing investment. A single small product with one theme and no second brand may justify only a handful of semantic tokens — actions, text, surfaces, status — and most of the value comes from those few. A system serving several products, platforms or brands leans on the tier far harder, because every decision it records saves the same edit in every consumer. The layer earns its cost roughly in proportion to how many places would otherwise have to change by hand, which is why the question "why not just use the palette?" has a different honest answer for a two-screen prototype than for a driver app shipped on three platforms.

  • Isn't a semantic token just indirection that makes values harder to find?
    It is indirection, and it does cost a lookup. It earns its keep when the same raw value carries different intents that may change independently, and when several products, platforms or themes consume the same decisions. For a single small product with one theme, a thin layer of a handful of semantic tokens may be all that is justified; the cost should scale with the number of places a change would otherwise touch.
  • How does the semantic tier help theming, and which part of theming is not the tier's job?
    Because components ask for purposes rather than colors, a theme can supply different values for those purposes without touching any component. The tier provides the hook. Deciding how each mode or brand remaps each semantic token, and switching between them, is a theming decision made on top of the tier.

A semantic token is like a rota role such as 'on-call engineer': people page the role, not a person, so when the rota changes nobody edits their contacts. A person still has their own number for when you truly mean that person.

saying these in an interview costs you the question

  • The semantic layer exists only so that themes can be swapped.
  • Semantic tokens are primitives renamed, so they add indirection and nothing else.
  • If two uses share a color today, they should share one semantic token.
  • The more specific each semantic token is, the better the layer works.
  • A semantic layer has no cost worth weighing against its benefits.