Custom Variant group-toggle Not Working with group-toggle/item – How to Configure Correctly? #17640
-
Hey everyone, I'm trying to create custom variants for a toggle-based structure in my Tailwind config. Here's what I have so far:
However, when I try to use something like Is there something I'm missing in the configuration, or do I need to structure the selector differently for this to work? Any guidance would be appreciated! Thanks in advance 🙌 Note: I'm using tailwind v3 btw. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Taking inspiration from core: tailwindcss/src/corePlugins.js Lines 156 to 159 in 4f9f603 You need to use matchVariant(
'group-toggle',
(_, { modifier }) =>
modifier
? `:merge(.group\\/${modifier}).toggle &`
: ':merge(.group).toggle &',
{
values: { DEFAULT: '' }
}
); The empty Using |
Beta Was this translation helpful? Give feedback.
Taking inspiration from core:
tailwindcss/src/corePlugins.js
Lines 156 to 159 in 4f9f603
You need to use
matchVariant()
so that you get access to the modifier (the string after the slash):The empty
DEFAULT
is so that the "root" name,group-toggle
can be used on its own. The value doesn't really matter, but the existance of…