Scoping theme variables to utilities #17400
-
I'm working with a design system that has many tokens, and we're trying to integrate them with a Tailwind theme. Is there a way to scope variables to specific utilities? For example, our design system has colors that should only be used as backgrounds, and others that should only be used for text. How can we constrain our classes to make sure these colors aren't used incorrectly? We're trying to modernize a very large codebase, and want the guardrails for our design system to be as strict as possible. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
There are undocumented property-specifc namespaces that you can use, i.e:
Search through the source code for others. |
Beta Was this translation helpful? Give feedback.
There are undocumented property-specifc namespaces that you can use, i.e:
background-color
--background-color-[name]
color
--text-color-[name]
border-color
--border-color-[name]
Search through the source code for others.