Strict tokens by token type in config #1400
Replies: 2 comments
-
there was a similar discussion on discord a few months ago pasting the original post so it can be indexed: freddie Take for example any color property. With strictTokens set to false, it will suggest colours in our tokens but also every valid css colour by name which is very off putting. Ideally we could remove the default CSS ones from the type suggestions, but still allow arbritrary values or the colorPalette values! Now let’s look into width: with strictTokens set to true, we can only choose from a pre-selected range of widths, but with it set to false we can do whatever we want. Sometimes I wish I could have strict tokens by token type. I could see the strict tokens options being expanded from a simple boolean to something like: {
...config,
tokenPolicies: {
base: "strict",
sizing: "relaxed",
color: "semi-strict"
}
} also related, a way to use arbitrary values with strictTokens: #1001 |
Beta Was this translation helpful? Give feedback.
-
I do like the idea, one benefit I would see is about migrations. About the "relax" by property : Having granular control over which properties are strict or not would greatly reduce the cost of a migration to panda-css. About the "semi-strict property : |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently,
strictTokens
is boolean across all token types.I'd love an option to incrementally adopt strict tokens. Consider
borderRadius
&width
. I feel it's quite common to have perhaps a set of only a few possible borderRadiuses, therefore it'd be great to force this to be strict.Width, however, is much harder. Odd exceptions, custom images etc all might require non-tokenized values.
So, if we were able to pick and choose which token types are strict, we can likely add more typesafety, where right now teams likely often leave this setting off.
Beta Was this translation helpful? Give feedback.
All reactions