-
Notifications
You must be signed in to change notification settings - Fork 200
Open
Description
Hi 👋
First of all, great work on motion-primitives. The MorphingDialog animations are excellent.
I have a question regarding programmatic control of the dialog open/close state.
From the current API and implementation, MorphingDialog manages its own internal state (isOpen) via context and does not expose any of the following:
- open / onOpenChange props
- ref or imperative handle
- a public hook to access setIsOpen
This makes it difficult to handle common use cases such as:
- Closing the dialog after an async action succeeds (e.g. submit / save / API call)
- Integrating with external state managers
- Coordinating dialog state with router navigation or mutations
Example use case
async function onSubmit() { await saveData() // how can I close MorphingDialog here? }
Question
What is the recommended way to control or close MorphingDialog programmatically?
Is it expected that consumers should:
- unmount the dialog?
- rely only on MorphingDialogClose clicks?
Or would exposing something like:
- open / onOpenChange
- or a public useMorphingDialog() hook be aligned with the intended design?
I’d love to understand the design decision here and the best practice moving forward.
Thanks in advance 🙏
Yeom-JinHo
Metadata
Metadata
Assignees
Labels
No labels