When to use
Section titled “When to use”- For a quick confirmation before an action that can be undone or has a small effect: archiving, removing a row from a list, deleting a draft.
When not to use
Section titled “When not to use”- For actions with a large effect or that cannot be undone: closing an account, a bulk refund. Use AlertDialog.
- When the action can be undone and is frequent: do not ask; offer undo in a Toast.
- When more information or a form is needed: use Dialog or Popover.
Anatomy
Section titled “Anatomy”- Trigger: the button that needs confirmation.
- Title: the question; it names the panel.
- Description: optional, one sentence on the result.
- Buttons: cancel and confirm.
Behaviour
Section titled “Behaviour”- Pressing the trigger opens the panel; focus moves to the cancel button.
- Confirm calls
onConfirm; when it returns a promise, loading shows and the panel closes when the work ends. - Cancel, Escape or an outside press calls
onCanceland closes the panel. - The panel cannot be closed while the work runs.
Guidelines
Section titled “Guidelines”- Write the action verb on the confirm button: “Delete”, “Archive”; not “Yes”.
- Keep the question short; use AlertDialog when details are needed.
Content
Section titled “Content”- The title is a question: “Delete this card?”.
- The description states the result: “This cannot be undone.”
Related components
Section titled “Related components”- AlertDialog: a blocking confirmation for heavy actions.
- Popover: a panel with interactive content.
- Toast: undo after the action.