Skip to content

Alert Dialog

A modal dialog that interrupts the user with an important message and expects a deliberate response.

Styled with CSS Tailwind

Basic Alert Dialog

Click the trigger to open. Unlike a Dialog, clicking the overlay does not dismiss it — the user must choose Cancel or Action. Focus lands on the Cancel button (the safe choice), is trapped inside, and returns to the trigger on close. Escape closes.

Controlled state

Drive the open state yourself with Open + OnOpenChange. Useful when an external event (e.g. an unsaved-changes guard) needs to open the alert — here the "Discard changes" button opens it.

An unhandled error has occurred. Reload 🗙