Overlays
Alert dialog
A confirmation that blocks until answered.
Usage
An alert dialog interrupts to ask for a decision that is hard to undo. It is not a separate component: it is a Dialog with role="alertdialog" and dismissible={false}, with Buttons in the footer. Esc and the overlay no longer close it, so the person has to choose.
When to use
- Deleting, revoking or overwriting something that cannot be recovered.
- Leaving a flow that would lose unsaved work.
Not for: routine confirmations (prefer undo with a toast), forms (use a dialog or a sheet), information (use an alert).
Writing the confirmation
- The title is the question: “Revoke Production key?”, not “Are you sure?”.
- The description says what is lost and whether it can be undone.
- Label buttons with the action (“Revoke key”), never “Yes” / “No”.
- Put the safe choice first in the tab order and give it focus; the destructive button uses the destructive variant.
- One destructive action per dialog.
Type to confirm
For the most damaging actions, make the person type the project name. The confirm button stays disabled until it matches, and the field is cleared when the dialog closes.
Async confirmation
When confirming starts a request, keep the dialog open: set loading on the confirm button, disable Cancel, ignore close requests while pending, and show a failure in place with a retry. Close only after it succeeds.
4 members on the Atlas team
API
There is nothing new to learn: see Dialog. The relevant props are role="alertdialog", dismissible={false} and showClose={false} on DialogContent, plus loading on Button. Use a controlled dialog (open / onOpenChange) when the confirm action is asynchronous.
Keyboard
| Key | Action |
|---|---|
| Esc | Does nothing: an alert dialog must be answered. |
| Tab | Moves focus between the dialog controls; it never leaves the dialog. |
| Enter / Space | Activates the focused button. |
Accessibility
- Follows the WAI-ARIA alert dialog pattern: role="alertdialog" with a title and a description.
- The page behind is inert and focus is contained; focus returns to the trigger on close.
- Errors that appear inside use role="alert" so they are announced.
- The destructive colour is never the only signal: the button label names the action.
Motion
- The same soft rise as Dialog: the panel rises 8px, scales from .96 and un-blurs (380ms), and leaves in 160ms.
- Reduced motion: it appears and disappears without movement.