Alert Dialog

A modal dialog that interrupts the user with important content and requires an explicit action, built on top of Base UI.

Installation

$ npx shadcn@latest add "/r/alert-dialog.json"

Usage

Examples

Custom Trigger

You can use any component as a trigger by using the render prop on AlertDialogTrigger.

Props

ComponentDescription
AlertDialogThe root component that manages the dialog state.
AlertDialogTriggerThe component that opens the dialog.
AlertDialogContentThe container for the dialog content, including backdrop.
AlertDialogHeaderContains the title and description for the dialog.
AlertDialogFooterContains the action and cancel buttons.
AlertDialogTitleThe accessible title for the dialog.
AlertDialogDescriptionThe accessible description for the dialog.
AlertDialogActionA button that performs the primary action (styled as an error button).
AlertDialogCancelA button that cancels the action (styled as a secondary button).