Alert Dialog
Ask the user to confirm or cancel an important action in a centered panel that only closes when they choose.
Installation
Usage
- Unlike Dialog, tapping the backdrop does nothing. Your buttons are the only way to close it, so always include one that cancels.
[(open)]two-way binds a signal. Set it totrueto open the dialog andfalseto close it.- The backdrop fades in and the panel scales up. Closing plays the reverse.
- The dialog draws in an
<overlay>, so it covers the whole screen wherever it sits in your template. <ui-alert-dialog-title>and<ui-alert-dialog-description>render<text>, so put plain text in them. The footer lays out its buttons in a row, aligned right.
Run code after it closes
closed emits once the close animation has finished, about 270ms after open turns false. It fires from a timer, outside any tap handler, so it's a safe place to navigate. To navigate straight from a button instead, wrap the navigation in setTimeout (see the setTimeout rule).
Panel width
class goes on the panel, which is w-4/5 wide by default.
API
UiAlertDialog
All sub-components (UiAlertDialogHeader, UiAlertDialogTitle, UiAlertDialogDescription, UiAlertDialogFooter) accept class.
Related
- Dialogs and overlays: how overlays work and which one to use
- Dialog: a dialog the backdrop can close
- Action Sheet: offer several actions instead of two
<overlay>: the element the dialog draws in
