Design Tokens in Code: The Decisions That Matter
Turning design decisions such as color and spacing into values that flow from design tools into code.
On this page
The key figures
- Single source
- tokens should have one authoritative definition
- Transformation
- tokens convert into platform-specific formats
- Theming
- token sets can define light, dark and brand variants
- Naming
- semantic names outlast literal ones
Why this is worth getting right
Tokens keep design and implementation aligned, and they make theming and rebranding far cheaper.
Do this, not that
Do
- Keep one source of truth for tokens
- Use semantic names rather than literal values
- Automate transformation into code formats
- Version tokens with the design system
- Test theme switching
Don’t
- Color values copied by hand into code
- Token names describing the value rather than the use
- Separate token sets drifting apart
- Manual updates after design changes
When to bring in help
Our advice Bring in help when design and code drift apart.
Where this comes from
- W3C — CSS Custom Properties
- Figma Help Center — Variables
The figures and practices above come from the sources listed.
Working on something like this?
We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.
Where to go next
Spotted something wrong? Report an error on this page. We correct on the page and say what changed.