Opening a Dialog without a trigger #1815
Replies: 1 comment
-
You are on the right track, sounds like you want a Dialog with controlled open state. Instead of setting Additionally, since your Dialog doesn't get triggered by an explicit trigger element, you may want to consider using https://react-spectrum.adobe.com/react-spectrum/DialogContainer.html instead. Example codesandbox: https://codesandbox.io/s/agitated-cannon-bsnfn?file=/src/App.js |
Beta Was this translation helpful? Give feedback.
-
We are looking at making a warning dialog. An example of when it would display is when a http request fails. so there is no input from the user required to trigger it. all the examples i can see on the documentation (https://react-spectrum.adobe.com/react-spectrum/Dialog.html) that the examples all have an action button that triggers the dialog. So I tried the following:
but when I click the button it doesnt close. It seems to be because I set isOpen to true all the time. This is only rendered when there is an error in my code.
Is there a way to open a dialog without an explicit trigger from a user?
Beta Was this translation helpful? Give feedback.
All reactions