-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Group Class with prefix config doesn't work #11384
Comments
@calvinagar The 2nd argument to addVariant is a selector or list of selectors. What you want is to write this as:
Here's a Tailwind Play of that working. |
Works perfectly, thank you! |
It doesn't work with named groups tho... Example: |
Hey! We've merged the fix for this in #11454. It'll be available in our next tagged release. In the meantime you can test it via our insiders build (it may take a few minutes to build & publish):
Thanks for reporting it! ✨ |
@thecrypticace Hi! As @stijn-code mentioned, nested groups don't work with custom variants. Is this a bug or is it impossible to create nested groups with custom variants? I wrote a demo project Playground |
@Movsar-Khalakhoev Named groups use the For your case the <div class="group-[&[data-loading=true]]/foo:bg-red-500"></div> However, if you want a more terse syntax (like matchVariant(
'group-loading',
(_, { modifier }) => {
return modifier
? `:merge(.group\\/${modifier})[data-loading=true] &`
: `:merge(.group)[data-loading=true] &`
},
{
// The `DEFAULT` value here lets you use group-loading/foo without an arbitrary value
// Otherwise you'd always have to write it as group-loading-[something-here]/foo:bg-red-500
values: { DEFAULT: null },
}
) Here's a Tailwind Play of this working. |
@thecrypticace Thank you for your help! This is exactly what I need! |
Hi @thecrypticace, Thanks for the example, but isn't this something that can automatically be fixed in your code? Or will this be the way till we have Tailwind 4? 😝 |
What version of Tailwind CSS are you using?
For example: v3.3.2
What build tool (or framework if it abstracts the build tool) are you using?
For example: postcss-cli 8.3.1
What version of Node.js are you using?
For example: v14.5.0
What operating system are you using?
For example: Ubuntu
Reproduction URL
https://play.tailwindcss.com/cxSWYn1qBg
Describe your issue
Have issue with prefix config and group hover
prefix: 'tw-'
parent : group
children: group-[.class]:tw-hidden
The text was updated successfully, but these errors were encountered: