Replies: 1 comment 3 replies
-
Hi @jacobrask Thank you for your interest in the design tokens plugin!
I think this depends on your perspective and the time scale taken into consideration. For our purposes a design token is a constant because there is nothing that will alter the value except for the design token source file. But this is different from another perspective. If you are building a framework that will be personalised by end users, then you want to give them the ability to override token values. This can be done with our plugin : @design-tokens url('./framework-tokens.json') format('style-dictionary3');
@design-tokens url('./personal-override-tokens.json') format('style-dictionary3');
.foo {
background-color: design-token('color.background.primary');
} Or by assigning to variables yourself : @design-tokens url('./framework-tokens.json') format('style-dictionary3');
.foo {
--framework-color-background-primary: design-token('color.background.primary');
}
/* user code */
.foo {
--framework-color-background-primary: purple;
} |
Beta Was this translation helpful? Give feedback.
-
The current approach of the design-tokens plugin is not compatible with design systems that use design tokens as CSS Custom Properties, which I think is is an unfortunate choice for a great tool otherwise focused on advancing CSS.
The reasoning seems to be
I'd like to argue the opposite, that many design tokens just represent a "slot" in a theme, and not a specific color.
Design tokens are often multi-tiered, where you would have a set of core tokens that are static, but semantic/decision tokens that may change.
Let's take the example from the docs
I would suggest modelling this as
It can even be extended with
And then anyone building components would do
With the way the design tokens plugin works today, would you be able to support a design system like this?
Beta Was this translation helpful? Give feedback.
All reactions