swisspost / design-system

The Swiss Post Design System pattern library for a consistent and accessible user experience across the web platform.
https://design-system.post.ch
Apache License 2.0
120 stars 14 forks source link

Token Guidelines #3371

Closed gfellerph closed 3 weeks ago

gfellerph commented 1 month ago

We should have a comprehensive documentation of our token system which explains the basic concept and the architecture we're using.

Basics

Design tokens — or tokens, for short — are design decisions, translated into data. They’re ultimately a communication tool: a shared language between design and engineering for communicating detailed information about how to build user interfaces.

Tokens consist of values needed to construct and maintain a design system, such as spacing, color, typography, object styles, animation, and more. They can represent anything that has a design definition, like a color as a RGB value, an opacity as a number, or an animation ease as Bezier coordinates.[^1]

Other resources:

Architecture

Tokens are categorised into 3 groups: core, semantic and component tokens. Each group has it's specific purpose and rules. The core and semantic layer are meant to be internal to the Design System, the component layer is intended to be used by the implementation. This enables introducing changes to the core and semantic layers without breaking changes in the component layer.

Core tokens

Core tokens are the most basic tokens and represent concrete values, for example yellow = #ffcc00 or size-16 = 16px.

Semantic tokens

Semantic tokens represent changes in design decisions across different environments, for example the body font-size that grows larger with increasing browser size. The semantic layer can also be seen as a mapping layer between the core and the component layer. It reassigns tokens to the correct values based on the current environment, for example styles for an external post themed page on a mobile device in dark mode.

Component tokens

On the last layer, component tokens are tied directly to components (or utilities) and their properties.

[^1]: Design tokens - Spectrum: https://spectrum.adobe.com/page/design-tokens/

Vandapanda commented 1 month ago

Started something on experience hub but didnt get to finish it yet, maybe we can combine that with the text above

gfellerph commented 3 weeks ago

Closing in favor of https://github.com/swisspost/design-system/issues/3448