Skip to content

Alert Dialog

A modal dialog that interrupts the user with important content and expects a response.

Install

Bash
npx @madeui/cli add alert-dialog

Usage

TSX
import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogMedia,
  AlertDialogTitle,
  AlertDialogTrigger,
} from '@/components/ui/alert-dialog';

Composition

TSX
<AlertDialog>
  <AlertDialogTrigger />
  <AlertDialogContent>
    <AlertDialogHeader>
      <AlertDialogMedia />
      <AlertDialogTitle />
      <AlertDialogDescription />
    </AlertDialogHeader>
    <AlertDialogFooter>
      <AlertDialogCancel />
      <AlertDialogAction />
    </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>

Media

Small

Destructive action

Use AlertDialogAction (a plain Button) instead of AlertDialogCancel when the confirming action needs to run async work — like this delete request — before the dialog closes.

API reference

Built on Base UI Alert Dialog. The tables below cover the props this library adds or changes — every other prop is forwarded to the underlying Base UI part; see the Base UI Alert Dialog API reference.

AlertDialogContent

PropTypeDefaultDescription
size'md' | 'sm''md'sm is narrower and keeps the footer buttons in a two-column grid.
styleStyleXStyles—StyleX styles merged last — always win over the component’s own styles.

AlertDialogAction

A plain Button (accepts variant, size). Wire your own onClick and close via the dialog’s open state, so destructive actions can await work first.

AlertDialogCancel

Base UI Close rendered as a Button.

PropTypeDefault
variantButtonVariant'outline'
sizeButtonSize'md'

Was this page helpful?