Alert Dialog
A modal question with a title, a description and two buttons, shown while key is open.
ui.alert_dialogBasic
if ui.button("Delete file…").danger().clicked() { ui.open_dialog("delete");}ui.alert_dialog("delete", "Delete this file?") .description("The file is removed from this device and from everyone it is shared with. This cannot be undone.") .cancel("Cancel") .confirm("Delete") .danger();Acting on the answer
if ui.button("Reset settings…").outline().clicked() { ui.open_dialog("reset");}// True once, in the frame the confirm button is pressed.if ui.alert_dialog("reset", "Reset all settings?").confirm("Reset").confirmed() { ui.toast("Settings reset");}API reference
| Setting | Description |
|---|---|
.description(text: impl Display) | The text below the title. |
.cancel(text: impl Display) | The cancel button's text; by default Locale::cancel ("Cancel"). |
.confirm(text: impl Display) | The confirm button's text; by default Locale::ok ("OK"). |
.danger() | Marks the action as irreversible: danger color, and initial focus on the cancel button. |
.confirmed() | Shows the dialog while open and returns whether it was confirmed this frame. |