- Hakan Ertan
- January 26, 2025
- No Comments
- 11 minutes
Advanced Token Design – How to Build Scalable Systems
Design tokens are the backbone of modern design systems. They encapsulate decisions about colors, typography, spacing, and more into reusable variables, acting as the connective tissue between design and development. Tokens ensure consistency, enable scalability, and simplify collaboration. Having worked with design systems for years, I can confidently say that mastering design tokens is essential for creating efficient, cohesive design systems—whether you’re working on a single brand or managing a suite of them.
Here’s a detailed guide to help you become a pro in design tokens:.
In this article
1. Understanding design tokens
What are design tokens?
Design tokens are variables that store reusable design decisions such as colors, typography, and spacing. Think of them as the DNA of your design system, translating abstract concepts into a format developers can directly implement. Instead of specifying a hex value like #FF5733 over and over, you reference a token like Primary-Button-Background. This approach centralizes your design decisions, ensuring consistency and ease of maintenance.
Why use design tokens?
Design tokens bring immense value to design systems by promoting consistency, scalability, and efficiency.
Here’s why I always advocate for design tokens:
- Consistency: They ensure every aspect of your design remains uniform across platforms.
- Efficiency: Tokens minimize redundant work for both designers and developers.
- Scalability: Easily adapt to new themes, brands, or platforms.
- Accessibility: Maintain consistent accessibility standards without extra effort.
2. Design token architecture
Setting up variables in Figma
Figma’s variables are a great way to start organizing your tokens, though they aren’t tokens in themselves. The key is aligning these variables with your design intent to translate them into functional design tokens that developers can use.
Token types
Global tokens
Global tokens serve as the foundational(Primitive) values within a design system. They are context-neutral and include core attributes such as typography settings, color palettes, and animation values. These tokens act as the building blocks for the system, directly usable or inherited by other types of tokens to maintain consistency.
Semantic(Alias) tokens
Semantic tokens are tied to specific contexts or abstractions. By providing meaningful names that convey their intended purpose, they help clarify the role of each token within the design system. Alias tokens are particularly useful for values that are reused across multiple scenarios, making them effective for maintaining a unified design language.
Component-specific tokens
Component-specific tokens encapsulate all the values associated with a particular component. While they often inherit from alias tokens, they are named explicitly to support precise application by engineering teams. This clarity allows for seamless implementation and fine-grained control during the development of individual components.
3. Anatomy and organization of design tokens
Effectively managing design tokens requires a clear understanding of their structure and how they fit into your design system. Design tokens are not just variables—they’re the foundation for maintaining consistency, flexibility, and efficiency in design and development workflows. Let’s break down their anatomy and explore best practices for their organization.
Key components of a design token
A design token is composed of essential elements that make it both human-readable and machine-usable:
- Naming convention:
The name is the unique identifier of a token, such as Primary-Button-Background. It should be descriptive and follow a consistent naming convention to ensure clarity and predictability. A good naming strategy uses hierarchical, context-rich structures like:- global.primary.color.background
- component.button.color.background
- Value:
The value is the actual data or property the token represents, such as #FF5733 for a color or 16px for a font size. The value should be context-independent when stored at a global level and adapted through aliases or semantic tokens when applied in specific use cases. - Category:
Each token is assigned a category, such as color, typography, or spacing, which groups similar tokens together. Categories improve discoverability and provide logical organization for easier management. - Context (or Metadata):
Metadata includes supplementary details about the token, such as where and how it’s used. This might include:
Accessibility notes (e.g., WCAG contrast compliance).
Associated components (e.g., used in the Button component).
Mode variations (e.g., light or dark mode).
Organizing tokens: A hierarchical approach
Tokens are most effective when organized hierarchically. This structure allows you to define global values and then refine them as needed for components, themes, or modes. A hierarchical JSON structure might look like this:
{
"global": {
"color": {
"primary": "#FF5733",
"secondary": "#33FF57"
},
"typography": {
"fontSize": {
"small": "12px",
"medium": "16px",
"large": "24px"
},
"lineHeight": {
"default": "1.5"
}
},
"spacing": {
"small": "8px",
"medium": "16px",
"large": "24px"
}
},
"component": {
"button": {
"color": {
"background": "global.color.primary",
"text": "global.color.secondary"
},
"padding": "global.spacing.medium"
}
}
}
4. Modes, collections, and themes
The flexibility of a design system often relies on how well it can adapt to different contexts, preferences, or brand identities. Modes, collections, and themes work together to ensure your design tokens provide the necessary adaptability and scalability.
Modes
Modes enable your design system to switch between user preferences or environmental conditions, such as light and dark themes or high-contrast settings for accessibility. By leveraging tokens for mode-specific values, you can create seamless transitions between these variations without duplicating efforts. For example, you might have a token for Background-Color with values that vary depending on the mode (e.g., light mode: #FFFFFF, dark mode: #121212).
Incorporating modes into your token structure not only improves user experience but also streamlines future expansions, such as introducing new modes or customizing for different devices. With modes, your system stays agile and adaptable to changing user needs.
Token collections
Token collections group related tokens into logical sets, simplifying updates and enhancing modularity.
For instance:
- Color tokens collection: Includes all tokens related to color palettes, like primary, secondary, or gradient tokens.
- Typography tokens collection: Houses font sizes, weights, and line heights.
- Spacing tokens collection: Contains padding, margin, and layout spacings.
This modular approach makes it easier to identify and update specific areas of your design system without affecting unrelated parts. Additionally, token collections can be reused across multiple themes or brands, ensuring consistency while reducing redundancy.
Themes
Image: https://help.figma.com/hc/en-us/articles/18490793776023-Update-1-Tokens-variables-and-styles
Themes integrate token values and modes into a cohesive visual identity tailored to a specific purpose, brand, or product line. A theme could define a brand’s personality through its colors, typography, and component styles, while also accommodating mode variations like light and dark.
Themes work by applying a combination of token collections and mode-specific values to create a distinct look and feel. For example:
- Brand A’s light theme: Combines light mode tokens with a unique brand color palette.
- Brand A’s dark theme: Adapts the light theme’s structure with dark mode values.
- Brand B’s themes: Reuses shared token collections like typography while applying different branding colors.
Centralizing your themes within the token architecture ensures easy updates, scalability, and the ability to support multi-brand systems effectively. Themes act as the final layer of abstraction, delivering a polished and consistent user experience that aligns with your goals.
5. Best practices for advanced theming
Theming can make or break the usability and scalability of a design system. Over the years, I’ve found that a well-executed theming strategy saves time, reduces frustration, and creates a cohesive user experience across platforms.
Here are my go-to tips for advanced theming, based on lessons learned from real-world projects.
1. Centralize theme management:
When I manage themes, I ensure there’s always a single source of truth. This could be a JSON file, a design tool like Figma or a specialized token management tool like Token Studio. Centralization makes updating tokens a breeze and ensures everyone—from designers to developers—works with the same set of values. It’s incredible how much confusion you can avoid by having one clear reference point.
2. Document theme structures:
I’ve learned that clear, detailed documentation is a game-changer. When I document themes, I focus on:
- Breaking down the structure (e.g., base tokens, mode-specific overrides, and component-level tokens).
- Showing practical examples of how themes are applied.
- Highlighting naming conventions and guidelines for expanding themes.
I always aim to create documentation that not only aligns the team but also serves as a helpful onboarding resource for new members.
3. Implement early:
I can’t stress this enough—think about theming early in your project. I’ve been in situations where themes were an afterthought, and the result was expensive and time-consuming refactoring. By considering themes from the beginning, you set the foundation for a scalable system that grows with your product.
4. Test thoroughly:
I test themes across different platforms, devices, and user settings to catch inconsistencies. For example, switching between light and dark modes might reveal contrast issues, or certain token values might not translate well across screen sizes.
I recommend a mix of automated and manual testing. Automated tools are great for catching structural inconsistencies, but manual testing helps ensure a polished, human-centric design.
5. Collaborate:
Theming isn’t a one-person job. I always make it a point to work closely with both designers and developers. For example, when defining token naming conventions, I involve both teams to ensure clarity and usability. Regular check-ins, shared workshops, and annotated examples have helped bridge gaps between design intent and development execution.
Additional insights
- Dynamic theming:
When building apps that support live theme switching (like a dark mode toggle), I prioritize performance. Lazy-loading assets or using optimized runtime solutions ensures that theme switching feels seamless for the end-user. - Multi-brand flexibility:
Managing multiple brands? I’ve found that creating a base set of global tokens with brand-specific overrides simplifies the process. This approach allows me to introduce new brands quickly without disrupting the core system. - Accessibility:
Accessibility has always been a priority for me. I test themes with accessibility tools to ensure compliance with standards like WCAG 2.1. This includes checking color contrast and usability for various modes and themes.
6. Figma as the source of truth
Figma is my go-to for managing design tokens effectively, acting as a central source of truth. By leveraging features like variables and Dev Mode, I can streamline the design-to-development workflow:
- Variables: Organize tokens into clear collections (e.g., Global, Theme-Specific, Component Variables) to mirror the token structure developers use.
- Dev mode: Developers can inspect elements, view token details, and export CSS or JSON directly, ensuring precise implementation.
- Annotations: Add notes to clarify token usage (e.g., “This uses the Primary-Button-Background token for light mode”).
- Collaboration tools: Mention Figma’s commenting and sharing features to enhance real-time collaboration between designers and developers.
- Version control: Highlight Figma’s ability to maintain version history, which helps track changes in tokens and designs over time.
- Live prototypes: Briefly touch on how tokens in Figma directly affect live prototypes, making it easier to test design decisions in context.
7. Managing design tokens
1. Token storage
For simple setups, I use JSON to define tokens clearly and ensure compatibility across platforms. A basic structure might look like this:
{
"colors": {
"primary": "#FF5733",
"secondary": "#33FF57"
},
"spacing": {
"small": "4px",
"medium": "8px"
}
}
I sync Figma with tools like Variables Pro | Swap, Import & Export Variables and Export/Import Variables by exporting variables as JSON, transforming them into platform-specific formats. Clear guidelines—like naming conventions (Global.Primary-Color) and documentation—keep token updates structured and collaborative.
2. Version control
Git isn’t just for code; it’s perfect for managing design tokens too. Committing changes to tokens ensures you can track every alteration, allowing for rollbacks if needed and fostering collaboration. I maintain a changelog to document changes, making it easy for teams to stay aligned.
# Changelog
## v1.2.0
- Updated `Primary-Button-Background` to `#FF4500` for better contrast.
## v1.1.0
- Added `Secondary-Text-Color` token for UI consistency.
3. Challenges and solutions
Managing tokens effectively comes with its own set of challenges.
Here’s how I address them:
Inconsistency:
- Solution: Schedule regular audits or implement automated checks to catch inconsistencies. Use tools that can scan your codebase or design files for outdated or misused tokens.
- Over-complexity:
Avoid token sprawl by focusing on tokens that genuinely offer value. Use semantic tokens to simplify and reduce the number of tokens needed. Regularly review and prune tokens that don’t contribute significantly to the design system. - Adoption issues:
Educate your team through workshops or documentation on how tokens streamline work, ensuring everyone understands their benefits and correct usage. Early involvement of all stakeholders can promote buy-in. - Performance:
Optimize by minimizing the number of tokens where possible. Consider lazy loading for tokens used in less common scenarios to avoid loading unnecessary data. - Conflicts:
Use version control systems like Git to manage conflicts. Employ clear, hierarchical naming conventions (Brand-Primary-Color vs. Component-Button-Background) to differentiate tokens at a glance. Also, maintain strict versioning to track changes across environments.
Wrap up
My final piece of advice? Start simple. Focus on high-value tokens that have the greatest impact, and grow your system iteratively. A thoughtful, well-maintained token strategy can save time, reduce errors, and keep your designs consistent—no matter how complex things get.
What’s been your experience with design tokens? I’d love to hear about your challenges, successes, or any tips you’ve picked up along the way.
No comment yet, add your voice below!