Design Tokens in a Design System
Discover the importance of Design Tokens in a Design System and explore the different types that enhance design consistency and efficiency.
Riccardo Marconato
Sep 12, 2023
Design System
Design tokens are essential pieces of a design system. Trying to manage a design system without even basic design tokens is pretty much impossible. Without them, you'd always be making decisions, and in a team or company, these would often get changed or overwritten by others.
A Design Token is a reliable standard for everyone. For instance, the Design Token "Red" might hold a value like #EE4B2B, which is different from #FF0000, even though they're both shades of red. The idea is that when we use the Design Token "Red," we're all on the same page that it refers to #EE4B2B. If it gets updated to another red in the future, everything tagged with "Red" gets updated automatically. This keeps our work consistent and coherent, allowing for easy theming and scalability.
Here's a simple definition of Design Tokens:
Design tokens are named items that store basic design values like colors or sizes. They're the building blocks of a design system. Since they're stored in a format that works across different platforms, they can easily replace hard-coded values.
Design Token Tiers
Tokens are typically split into different levels, each serving specific purposes and adding unique features to the design system.
Tier 1 — <Foundational/Global/Core/Fundamental> Tokens
These hold basic values with context-free names and mainly shape the final product's look by setting all values that can be used directly.
Tier 2 — <Alias/Semantic/Theme> Tokens
They build on Tier 1 tokens to clarify their use and purpose in specific contexts, making them widely used across different projects and products. They represent choices or intentions that appear in multiple places.
Tier 3 — <Component> Tokens
These often build on Tier 2 tokens and are tied to specific component values (or overrides), allowing teams to be as detailed as possible with their components.
Differences between Primitive Tokens, Semantic Tokens, and Component Tokens
Primitive Design Tokens:
Foundational Elements: These are the basic building blocks of a design system, covering core design attributes like colors, typography, spacing, shadows, and other essential design properties.
Raw Values: They hold raw, indivisible design values. For instance, a primitive token might define a color as "red" = "#FF2800" or a font size as "font-size-large" = "24px".
Core Consistency: They ensure consistency across the design system by standardizing basic visual properties throughout the project.
Semantic Design Tokens:
Layer of Abstraction: Semantic tokens take primitive tokens and give them a meaningful or contextual twist, often related to their use or size. For example, "border-medium" could be a semantic token pointing to a specific border width.
Contextual Naming: These tokens use terms like "small," "medium," "large," or "primary," "secondary," to hint at sizes, weights, or importance. For instance, "spacing-large" might tie back to a specific spacing value from the primitive tokens.
Adaptability and Theming: They make it a breeze to apply consistent styles across different themes or modes (like light and dark) without tweaking the underlying primitives. For example, "background-default" might mean different colors in various themes but stays consistent in meaning.
Enhanced Communication: By using terms that describe their role or size, semantic tokens help designers and developers communicate better, making the design system more understandable and easier to work with.
Component Tokens:
Component-Specific Design: These are tailored to specific UI components, defining design properties for items like buttons, cards, modals, etc. For example, a button might have component tokens like "button-border-radius" or "button-padding".
Customization and Flexibility: They allow components to be easily customized or themed while sticking to consistent design principles. Different button styles (primary, secondary, danger) can all be handled through component tokens.
Consistency within Components: Component tokens make sure all instances of a specific component maintain visual consistency, even when design tweaks happen. This is super helpful in managing complex design systems where a single component might pop up in various contexts.
Integration with Primitive and Semantic Tokens: Component tokens often pull from primitive and semantic tokens to keep the design system consistent at every level. For example, a "button-background" component token might use the "primary-color" semantic token, which in turn refers to a primitive color value.
Adapting Design Tokens to your Design System
Not everything we've talked about so far applies universally. Design Tokens can really differ based on the product, and not every Design System works for every situation. It's important to customize the tokens to meet the project's needs and tweak them for the best outcomes.
For example, sometimes the line between Semantic and Component tokens isn't so clear, and the distinction between Foundation and Semantic can change too. The suggested Tier levels might not be consistent everywhere. Some products might have loads of Design Tokens for just one component, while others might only use the Foundation and Semantic levels.
That said, having too many Tokens can make the system tricky to handle. But, don't cut back too much either, as you might end up limiting the design system's flexibility.