Expose set handler in useDisclosure hook
#8359
snelsi
started this conversation in
Feature requests
Replies: 1 comment 1 reply
-
|
You can use useToggle for this use case – https://mantine.dev/hooks/use-toggle/ |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
🧩 Feature Request: Expose
sethandler inuseDisclosurePlease consider exposing a
sethandler in theuseDisclosurehook API.It would provide more flexibility when integrating
useDisclosurewith components or libraries that expect explicit state control viaonChangeoronOpenChangeprops (for example, Radix UI Dialog/Popover components).💡 Motivation
Currently,
useDisclosureprovides:While this works perfectly for internal state management, it can be challenging to integrate with headless UI libraries that expect an explicit setter function, e.g.:
Right now, I need to manually wrap the
useDisclosurelogic to bridge these APIs — something like:Having
setexposed by default would simplify this pattern and make the hook more composable across different component ecosystems.🧠 Proposed API
Where:
So that it can be used as:
Beta Was this translation helpful? Give feedback.
All reactions