-
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
Open closed state #466
Open closed state #466
Conversation
This pull request is being automatically deployed with Vercel (learn more). headlessui-react – ./packages/@headlessui-react🔍 Inspect: https://vercel.com/tailwindlabs/headlessui-react/He6yRLykAjWSNstWPvN1UfJizD2r headlessui-vue – ./packages/@headlessui-vue🔍 Inspect: https://vercel.com/tailwindlabs/headlessui-vue/37pAYKKQ48epuwuYfPo5ZfBrL3eo |
82db7bb
to
51b65b6
Compare
51b65b6
to
25d3fd5
Compare
The example you shared, it totally makes sense. But how we will handle those cases in which we actually need |
@mudssrali this code is in addition to the existing code. There are no breaking changes here, so you can still do what you could do before! 😄 |
Thanks for clearing up! 😃 |
This allows us to update the ref and everything should work after that. Currently we only saw the "current" state.
25d3fd5
to
fee8f45
Compare
* simplify examples by using the implicit open/closed state * introduce Open/Closed context (React) * use Open/Closed context in Dialog component (React) * use Open/Closed context in Disclosure component (React) * use Open/Closed context in Listbox component (React) * use Open/Closed context in Menu component (React) * use Open/Closed context in Popover component (React) * use Open/Closed context in Transition component (React) * introduce Open/Closed context (Vue) * use Open/Closed context in Dialog component (Vue) * use Open/Closed context in Disclosure component (Vue) * use Open/Closed context in Listbox component (Vue) * use Open/Closed context in Menu component (Vue) * use Open/Closed context in Popover component (Vue) * use Open/Closed context in Transition component (Vue) * use a ref in the Description comopnent This allows us to update the ref and everything should work after that. Currently we only saw the "current" state. * add more Vue examples * update changelog
@RobinMalfait getting the error |
It might not be immediately obvious what this does, but essentially it allows us to communicate between our components without the need of being explicit. For example, here is a before:
This is great, it all still works, but we can also simplify it to this:
A few things to notice:
open
prop.show
prop on the Transition component.static
prop on theMenu.Items
.If you have components that work together with other components / libraries then you can still control all of this.
Relying on a shared context allows us to not be coupled to other components. This in turns means that once we start working on the build output and tree-shakings that we don't have to worry about all these interconnected components.