Primitives
Primitive

Alert Dialog

Modal dialog that interrupts the user with important content and requires an action

An alert dialog is a modal that interrupts the user to confirm a consequential action. Use it for destructive or irreversible choices such as deleting an account, where the user must explicitly confirm or cancel.

For non-blocking dialogs the user can dismiss freely, use Dialog instead.

Preview

Installation

Usage

Composition

Examples

Controlled

Use the open and onOpenChange props on AlertDialog to control the open state.

Nested

Nest alert dialogs to chain multi-step confirmations.

Detached Trigger

Use createAlertDialogHandle() to drive one dialog from triggers rendered outside it.

API Reference

The AlertDialog component is built on top of Base UI's AlertDialog. All Base UI props are supported. The documentation below only covers custom props specific to our implementation.

For the complete Base UI API, see the Base UI AlertDialog documentation.

Utilities

createAlertDialogHandle

Creates a handle that connects an alert dialog to one or more external AlertDialogTrigger components. Useful when the triggers need to live outside the AlertDialog, for example when each row in a list has its own delete button but they all share one confirmation dialog.

Passing data from the trigger to the alert dialog

The handle accepts an optional <Payload> generic that types a value each trigger can pass along. The alert dialog reads it through a render-prop child, so you can render different content (or target different resources) per trigger without duplicating the dialog markup.

Without the <User> generic, payload inside the render prop resolves to unknown.

Props

AlertDialogContent

Modal container for important messages requiring user action. Composes AlertDialog.Portal, AlertDialog.Backdrop, and AlertDialog.Popup. Props are forwarded to AlertDialog.Popup.

Prop

AlertDialogBody

Scrollable content area within the alert dialog.

Prop

Notes

AlertDialogClose

Use AlertDialogClose with the render prop to create action buttons that close the dialog. Wraps Base UI's AlertDialog.Close.