Design systems
A design system is the shared set of decisions, parts and rules a product is built from. Tokens hold the small decisions like colours and spacing, in layers, so one change reaches every screen. Components come with variants, states and documentation. Governance decides what goes in. It works only when design and code use the same names and engineers help build it.
Author: bezzad
Contents
The problem: fourteen buttons
Our online shop has grown for five years. Four teams build its pages. An audit of the live site finds:
- Fourteen kinds of primary button, with small differences in colour, corner radius and height.
- Nine shades of grey for text, most of them used only once.
- Three different date pickers, each with its own bugs.
- No dark mode, because colours are written by hand in hundreds of places.
Nobody decided to make fourteen buttons. Each team made one good local decision at a time. A design system makes these decisions once, in one place, for everybody.
What a design system is
A design system is more than a component library in a design tool.
- Tokens: named values for the small decisions: colour, spacing, type size, radius, shadow.
- Components: reusable parts like a button, a text field or a product card, in design and in code.
- Patterns: how components work together for a common task, like a form with errors or an empty state.
- Documentation: when to use each part, and when not to.
- Governance: who decides what goes in, how people ask for changes, and how changes are released.
If only the design file exists and the code does something else, it is not a system. It is a picture of one.
Design tokens
A token is a design decision with a name. Instead of the colour code for blue in 300 places, every place uses the name of the decision.
Tokens in layers
Most systems use two or three layers:
- Primitive tokens (also called base or global): the full set of raw values. For example, blue 600 is a certain blue. They say nothing about where to use them.
- Semantic tokens (also called alias tokens): the meaning. For example, “action primary” points to blue 600. “Text muted” points to grey 600.
- Component tokens (optional): one component’s own decisions. For example, “button primary background” points to “action primary”.
Why the layers?
- Screens use semantic names, so a designer chooses “danger”, not “red 600”. The meaning is clear.
- A rebrand changes one line. Point “action primary” to a new colour, and every button, link and focus ring follows.
- Dark mode is a second mapping. In dark mode, “surface” points to a dark grey instead of white. The components do not change at all.
Tokens as files
Tokens live in a file that both design tools and code can read. The W3C Design Tokens Community Group published the first stable version of its format (2025.10) in October 2025. A small example in that format:
{
"color": {
"blue": {
"600": {
"$type": "color",
"$value": {
"colorSpace": "srgb",
"components": [0.114, 0.306, 0.847],
"hex": "#1d4ed8"
}
}
},
"action": {
"primary": {
"$type": "color",
"$value": "{color.blue.600}"
}
}
},
"space": {
"md": {
"$type": "dimension",
"$value": { "value": 16, "unit": "px" }
}
}
}
- The curly braces make an alias. “Action primary” points to blue 600.
- A build step turns this one file into what each platform needs, for example CSS custom properties for the web:
:root {
--color-blue-600: #1d4ed8;
--color-action-primary: var(--color-blue-600);
--space-md: 16px;
}
.button-primary {
background: var(--color-action-primary);
padding-inline: var(--space-md);
}
Components
Anatomy and properties
Each component has parts (anatomy) and properties that change it. For the shop’s button:
- Anatomy: a container, a label, and an optional icon.
- Properties: kind (primary, secondary, ghost, danger), size (small, medium, large), with or without an icon, full width or not.
- Content: the label text, for example “Add to cart”.
Variants and states
A variant is a version the designer chooses on purpose: a primary or a secondary button. A state is how the component reacts to the user or the system: hover, pressed, focus, disabled, loading.
- Every variant needs every state. A secondary button with no focus style is a bug for keyboard users.
- The focus state must be clearly visible and meet the contrast rules from the accessibility lesson.
- A loading state (for example on “Pay”) stops double clicks and keeps the button the same width.
- Disabled needs care. A disabled button with no explanation leaves people stuck. Often it is better to keep the button active and show what is missing when it is pressed.
Do not make a variant for everything
If every combination is its own variant, four kinds, three sizes, with and without an icon, and five states already make 120 versions. Use properties instead: kind, size and “has icon” are separate switches. Then the design tool and the code both stay small.
A common way to think about the levels is atomic design, by Brad Frost: atoms (a button, a label), molecules (a search field with a button), organisms (the header), then templates and pages. It is a way to think, not a rule you must follow exactly.
Documentation
A component without documentation gets used in the wrong way, or rebuilt. For each component, write:
- What it is for, and when not to use it. “Use a danger button only for actions that delete or cancel.”
- Anatomy, variants and states, with pictures.
- Behaviour: what happens on click, keyboard use, long text, small screens.
- Accessibility: the role, the accessible name, the focus order, the keys.
- Content rules: “Start the label with a verb: Add to cart, not Cart addition.”
- Do and do not examples from real screens of the shop.
- Links to the design component and the code component, and the status: draft, stable or deprecated.
Governance: who decides what goes in
Without governance, the system either becomes a wall that blocks every team, or a junk drawer where everything is accepted.
Common models:
- Centralised: a dedicated system team builds everything. Quality is consistent, but the team can become a bottleneck.
- Federated: designers and engineers from product teams contribute, and a small group reviews. It grows faster, but needs clear rules.
- Hybrid: a small core team plus contributions from product teams. Many companies end up here.
A typical path for a new request, for example “We need a product rating stars component”:
- Check what exists. Maybe an existing component can do it with a small change.
- Ask if it is shared. Is it needed in more than one place? If only one team needs it, it can stay in that team’s code for now.
- Propose it with the use cases, a draft design and the states.
- Build design and code together, with an engineer from the start.
- Document and release it with a version number and a changelog.
- Deprecate with care. When something is replaced, mark it deprecated, give a migration path and a date. Do not delete it overnight.
Working with engineers and handoff
The system is only real when it exists in code. That makes engineers partners, not receivers.
- Use the same names. If the design file says “Button / Primary / Large” and the code says “BigBlueButton”, every handoff becomes a translation.
- Involve engineers early. They know what the platform can do, what already exists in code, and what is expensive.
- Design with tokens, not raw values. Then the inspect view in the design tool shows “space md”, not “16” that somebody must guess.
- Hand off more than the happy screen: the user flow, every state, long text and empty data, error cases, responsive behaviour, focus order and motion details.
- Talk, do not only hand off. A short walkthrough answers questions a file never will.
- Review the build. Check the real feature in a test environment before release, and fix the gaps together. This is often called design QA.
Measuring if it works
- Adoption: how many screens use system components, and how often teams detach or override them.
- Speed: how long it takes to build a common screen now compared to before.
- Quality: fewer accessibility bugs, and fewer visual differences between pages.
- Feedback: ask the teams who use it. A system that teams avoid is not working, whatever the file looks like.
Common mistakes
| Mistake | Result | Better way |
|---|---|---|
| Only a design library, no code | Design and product drift apart. | Build design and code together, with the same names. |
| Screens use primitive tokens | A rebrand or dark mode touches every screen. | Screens use semantic tokens only. |
| A variant for every combination | Hundreds of versions nobody can maintain. | Separate properties: kind, size, icon. |
| Missing states | Each team invents its own focus or loading style. | Every variant has every state. |
| No documentation | Wrong use, or the part is rebuilt. | When to use, when not, states, accessibility, examples. |
| Accepting every request | A junk drawer. | Check existing parts, ask if it is shared, then propose. |
| Deleting old components overnight | Broken screens and angry teams. | Deprecate with a migration path and a date. |
| Handing off only the happy screen | Engineers guess the other states. | Flows, all states, edge cases, and a walkthrough. |
Summary in 7 lines
- A design system is tokens, components, patterns, documentation and governance, in design and in code.
- Tokens are named decisions in layers: primitive, semantic, and sometimes component.
- Screens use semantic tokens, so a rebrand or dark mode is a change of mapping, not of every screen.
- Components have anatomy, properties, variants and states. Every variant needs every state, including focus.
- Documentation says when to use a part, when not, how it behaves and how it is accessible.
- Governance decides what goes in. Check what exists, ask if it is shared, release with versions, deprecate with care.
- Engineers are partners: same names, early involvement, full handoff, and a review of the real build.