Skip to content

How to use the Dialog component with headlessui's Transition component in an uncontrolled way? #1939

Answered by benoitgrelard
paulwongx asked this question in Help
Discussion options

You must be logged in to vote

Is there a way to extract the [data-state] open and closed attribute from the Dialog.Content into a javascript variable so I can pass it into the Transition.Root, in the show prop?

Yes, by using the controlled API, as you have discovered. That is what it is for. It enables use cases where you need access to the state outside (like JS animations for example).

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@paulwongx
Comment options

@joaom00
Comment options

@paulwongx
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by paulwongx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants