Skip to content

Is it possible to externally control a Disclosure's open/close state? #1578

Answered by TheSisb
sebm asked this question in General
Discussion options

You must be logged in to vote

Hi @sebm,

This part of our docs kind of alludes to it: https://paste.twilio.design/components/disclosure#using-state-hooks
It isn't super clear though, but yes you can tap into internal state of any of our components. Here's an example solution with Disclosure: https://codesandbox.io/s/controlled-disclosure-toggle-state-regp5?file=/pages/index.js

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by SiTaggart
Comment options

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