Replies: 2 comments 2 replies
-
This is a good use case for Fwiw the solution I'm used to seeing for the specific problem you described is to add a prop for "color"/"intent"/etc, and then have logic to say something like "color with a fallback of red" or "if intent is primary, red. if intent is secondary, blue". In some cases, that can have added self-documentation benefits. |
Beta Was this translation helpful? Give feedback.
-
I published The static variant is super easy and simply repeats the selector.
const plugin = require('tailwindcss/plugin')
module.exports = {
// ...
plugins: [
plugin(function({ addVariant }) {
addVariant('trump', '&&')
})
]
} Play with it here |
Beta Was this translation helpful? Give feedback.
-
I would like to propose an alternative method to increase CSS specificity to the
!
important modifier.I suggest to support an adjoining classes modifier like
trump:
orbump:
.It would render the utility like:
Generated CSS:
A simple live example.
Background:
Using tailwind for component or design systems often has the need to override tailwind classes of a component, e.g. colors or dimensions.
I found these posts explain the problem at hand very well.
Related issues:
Beta Was this translation helpful? Give feedback.
All reactions