Replies: 3 comments
-
|
Started something on experience hub but didnt get to finish it yet, maybe we can combine that with the text above |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Added as task in #3448 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@gfellerph FYI content partially available in WIKIT / Design Tokens / Overview (content mainly from #3371 ) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We should have a comprehensive documentation of our token system which explains the basic concept and the architecture we're using.
Design Tokens: A Guide for Building Consistent and Scalable Interfaces
Basics
Design tokens — or simply "tokens" — are a way to encapsulate design decisions into data that can be consistently shared and applied across different platforms, technologies, and tools. They serve as a communication bridge between design and engineering, enabling teams to implement UI elements with precision and consistency. By converting visual styles into structured data, design tokens help maintain a design system that is flexible, scalable, and easier to manage over time.
A token represents an atomic value that’s reusable and foundational to the design system, such as colors, spacing, typography, borders, animations, etc. These values can be stored in a format (e.g., JSON, YAML, or CSS variables) and used across web, mobile, or any other platform. For example:
primary-color = #ffcc00overlay-opacity = 0.7ease-out = cubic-bezier(0.25, 0.8, 0.5, 1)Design tokens provide a single source of truth that ensures consistency across a product's entire interface, no matter where or how it’s implemented.
Further Reading & Resources
Design Token Architecture
Design tokens are generally categorized into three key layers: Core, Semantic, and Component tokens. Each layer has a specific role within the design system, ensuring that tokens are scalable and adaptable without breaking downstream implementations.
1. Core Tokens
Core tokens represent raw values or base design elements such as colors, sizes, or font properties. These are the fundamental building blocks that don’t contain any context or semantic meaning—they are purely the static, unchanging values that are used throughout the design system.
Guidelines for Core Tokens:
yellow = #ffcc00orsize-16 = 16px).brand-color = #ffcc00, it should be namedyellow = #ffcc00.sandgraycan be defined assandgray-alpha-50 = rgba(sandgray, 0.5).2. Semantic Tokens (Mapping Layer)
Semantic tokens define contextual meaning for design decisions, mapping core tokens to more meaningful concepts. These tokens account for dynamic variations in design based on environment, theme, mode (light/dark), or platform (mobile/desktop). Semantic tokens create an abstraction layer between core values and components, allowing flexibility without direct exposure to the underlying values.
Guidelines for Semantic Tokens:
Semantic tokens capture design intent and map core tokens to specific design concepts (e.g.,
brand-color,font-size-base).These tokens can adapt based on the environment, such as viewport size, themes, or modes. For instance, a semantic token for font size might change across different devices:
font-size-baseSemantic tokens can reference both core tokens and other semantic tokens, ensuring flexibility for dynamic environments.
Semantic tokens are usually not directly referenced in applications; instead, they are applied via an automated process (e.g., theming or responsive design frameworks).
Semantic tokens should be structured in groups based on environment factors such as themes (cyber security/cargo), modes (light/dark), devices, and channels. For example, there could be separate tokens for different subsidiaries, or external and internal platforms.
Example:
background-colorsemantic token might map tocore-color-black, while in light mode, it might map tocore-color-white.3. Component Tokens (Implementation Layer)
Component tokens apply the design tokens to specific components in the UI, like buttons, input fields, or cards. These tokens reference semantic tokens or core tokens based on the component’s design needs. By tying tokens directly to component properties, we ensure that the design system can be applied consistently in any context or platform.
Guidelines for Component Tokens:
color, use terms likebutton-background-colororcard-border-radius.button-padding-left = interactive-padding-left). If the value is static, they can reference core tokens directly.Cross-platform Considerations
One of the most powerful benefits of design tokens is their ability to ensure consistent design across multiple platforms, such as web, mobile (iOS and Android), and even desktop applications. By creating a universal design language, teams can maintain a cohesive look and feel across all touchpoints, while still allowing for platform-specific nuances.
Considerations for Cross-platform Design:
Platform-specific adjustments: While the same design tokens can be used across platforms, there may be cases where certain adjustments are necessary (e.g., mobile uses a different typography scale or spacing system). In such cases, tokens should be designed with enough flexibility to adapt to platform-specific needs while maintaining overall consistency.
Example: On mobile, touch targets might require larger padding, so a semantic token for padding could have platform-specific values:
button-paddingEnvironment-specific tokens: By defining tokens that are tied to environments (e.g., dark mode for mobile), teams can ensure that UI components adapt appropriately without manual intervention.
For instance, a dark mode button background might change across platforms, but it’s still managed through tokens:
button-background-darkTooling integration: Make sure your tokens are structured and exported in a format that works seamlessly across different platforms. Tools like Style Dictionary or Theo can help convert design tokens into platform-specific formats such as SCSS, XML, or JSON, ensuring that each platform gets the correct values.
Accessibility and Design Tokens
Design tokens play a crucial role in ensuring that a product is accessible to all users, as they help standardize the application of key accessibility principles such as contrast ratios, font sizes, and motion preferences. By using tokens thoughtfully, accessibility can be "baked in" to your design system.
How Tokens Support Accessibility:
Color contrast: Using tokens to define color combinations for text and backgrounds can help ensure the contrast meets accessibility standards (e.g., WCAG guidelines). For example, a semantic token like
text-on-primarycan reference a core token with a high-contrast color value. You can then adjust these tokens based on dark or light mode requirements to meet the appropriate contrast ratios.Example:
Scalable typography: Defining font sizes, line heights, and spacing as tokens allows for easier scaling across devices, ensuring readability at different screen sizes. Tokens like
font-size-baseorline-height-largecan be adjusted responsively across platforms, improving accessibility for users with visual impairments.Reduced motion: Some users prefer reduced animations for accessibility reasons. By creating tokens that control animation properties (e.g.,
animation-durationoranimation-ease), you can easily adjust motion across the interface in response to user preferences.Example:
Consistent touch targets: Design tokens for spacing and padding ensure that interactive elements like buttons or links maintain appropriate touch target sizes, which is critical for accessibility on mobile devices.
By integrating accessibility considerations into your design tokens, you can create a more inclusive product that meets the needs of all users, regardless of ability.
Summary
Design tokens serve as the foundation of a well-structured design system, promoting consistency, scalability, and flexibility. By separating tokens into layers—core, semantic, and component—we create a system that is not only adaptable to changes in design but also easily maintainable. Tokens help ensure cross-platform consistency, enable easier adaptability for different environments, and support accessibility, making them essential for building user-centric, inclusive products.
Beta Was this translation helpful? Give feedback.
All reactions