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鈥檇 love to understand the design decision here and the best practice moving forward.
Thanks in advance 馃檹
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:
This makes it difficult to handle common use cases such as:
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:
Or would exposing something like:
I鈥檇 love to understand the design decision here and the best practice moving forward.
Thanks in advance 馃檹