Sub topic 7
Share decisions through design tokens
Prerequisites and the working model
Assume you understand basic brand elements such as logo, color, typography, and spacing. You should also know that a website or app is built from reusable components such as buttons, cards, and forms.
A design token is a named value that represents a design decision. Instead of repeating #1A4D8F throughout a codebase, a team gives that color a name such as color.brand.primary. The name explains the decision and lets design and engineering tools share it.
Tokens create a shared source of truth. Designers can use the same values in design files, while developers can convert them into CSS variables, mobile constants, or email styles. A token does not make every channel identical. It keeps important brand decisions connected while allowing each channel to use its own format.
Separate raw values from meaning
A useful token system has at least two layers:
- A raw, or primitive, token stores a value such as a color, font family, or spacing unit.
- A semantic token describes the role of that value, such as primary action, body text, or page background.
For example, color.blue.700 describes a color value. color.action.primary describes how the brand uses that value. A button should normally reference the semantic token. If the brand changes its primary action color later, the component can change without editing every button.
| Token layer | Example | Main purpose |
|---|---|---|
| Raw | `color.blue.700` | Store a reusable value |
| Semantic | `color.action.primary` | Describe a design role |
| Component | `button.primary.background` | Apply a role to a specific component |
This separation prevents component code from becoming a collection of unexplained values. It also makes a redesign safer because the team can update a semantic mapping instead of searching through every channel.
Define a small token set
Start with decisions that recur across touchpoints. Common groups include:
- Color: brand, text, surface, border, and status colors
- Typography: font families, sizes, weights, and line heights
- Spacing: a base unit and common gaps
- Shape: corner radii and border widths
- Motion: duration and easing values
Use names that describe purpose rather than appearance. color.text.default remains useful if the exact color changes. color.dark-blue becomes misleading when the palette changes.
The following JSON describes a small shared token set:
{
"color": {
"brand": {
"primary": { "value": "#1A4D8F" },
"accent": { "value": "#F2A900" }
},
"text": {
"default": { "value": "#1B1B1B" },
"inverse": { "value": "#FFFFFF" }
}
},
"font": {
"family": {
"heading": { "value": "Georgia, serif" },
"body": { "value": "Arial, sans-serif" }
}
},
"space": {
"base": { "value": "8px" }
}
}The file is data, not necessarily the format consumed directly by a browser. A token tool or build step can transform it into platform-specific outputs.
Use tokens in components
The generated CSS can expose the decisions as custom properties. A component then references token names instead of hard-coded values.
:root {
--color-brand-primary: #1A4D8F;
--color-brand-accent: #F2A900;
--color-text-default: #1B1B1B;
--color-text-inverse: #FFFFFF;
--font-heading: Georgia, serif;
--font-body: Arial, sans-serif;
--space-base: 8px;
}
.button-primary {
background-color: var(--color-brand-primary);
color: var(--color-text-inverse);
font-family: var(--font-body);
padding: var(--space-base) calc(var(--space-base) * 2);
}A production system might add semantic aliases:
:root {
--color-action-primary: var(--color-brand-primary);
--color-action-primary-text: var(--color-text-inverse);
}The button can use the aliases, which makes its intent clear. Tokens should still be checked for contrast, readability, and behavior in every supported context.
Connect tokens to the brand workflow
Store token changes with version history and record an owner for approving them. A color change can affect a website, app, presentation template, email, and printed material. Review the outputs before publishing the change.
Exercise
Exercise
A primary button uses a hard-coded blue value in three codebases. What should the team change first?
Show answer
Create a named shared token for the primary action color, map each codebase to that token, and then update the value through the token source.