Alert Dialog

A modal dialog that asks the user to confirm an action.

Installation

  1. Add the registryOnce per project
  2. Add alert-dialog

Usage

Unlike a Dialog, an alert dialog doesn't close when you click outside it. AlertDialogCancel closes it, but AlertDialogAction doesn't, so control the dialog with open and onOpenChange and close it when the action finishes.

Always include an AlertDialogTitle and AlertDialogDescription.

Composition

Examples

Destructive

Set variant="destructive" on the action for things that can't be undone.

Props

The tables leave out className, style and render. Parts built on Base UI take them as its styling and composition guides describe.

AlertDialog

AlertDialogTrigger

AlertDialogPortal

AlertDialogOverlay

AlertDialogContent

AlertDialogAction

AlertDialogCancel