-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add @headlessui/tailwindcss
plugin
#1487
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@headlessui/tailwindcss
plugin@headlessui/tailwindcss
plugin
5b0c1ec
to
0ab276a
Compare
All components that expose boolean props in their render prop / v-slot will receive a `data-headlessui-state="..."` attribute. If it exposes boolean values but all are false, then there will be an empty `data-headlessui-state=""`. If the current component is rendering a `Fragment` then we don't expose those attributes.
We were using the CDN, but now that we have the `@headlessui/tailwindcss` plugin, it's a bit easier to configure it natively and import the plugin.
0ab276a
to
30aeaf2
Compare
@headlessui/tailwindcss
plugin@headlessui/tailwindcss
plugin
@RobinMalfait I'm curious about the addition of the |
@hailwood in a lot of cases that's true, but you can also combine those and then it can be useful: Here is an example where you explicitly check for the |
The I say this because, as far as I can tell, this new plugin is only used for state variants. And traditionally state variants only have additive value. i.e. you dont have a As for your example: You could argue that the second option is more code, but it's also (maybe) more verbose. It's also more familiar when compared to other tailwind classes. I suppose you could just not use the |
Totally see what you're saying and agree on the simplicity sticking to things being additive most of the time but I don't think this is an anti-pattern, to me it's no different than how we have support for both We also recently added the We'll likely be merging this PR or some flavor of it that adds I don't think people will need to reach for this stuff super often but I think it's helpful to have 👍🏻 |
This PR adds a new
@headlessui/tailwindcss
plugin so that you can style your components using justthe css without requiring a render prop or a
v-slot
in your templates.Before:
After: