Skip to content
SevenUI
Sign in
On this page

Alert Dialog

A modal dialog that interrupts the user with important content and expects a response, built on the Base UI Alert Dialog primitive.

Installation

Bash

Usage

Examples

With media

AlertDialogMedia renders an icon tile; size="sm" produces the compact, center-aligned layout.

API reference

AlertDialog

Extends the Base UI Alert Dialog Root. Always modal and never dismissed by an outside press — both are enforced by the primitive itself: the Root accepts no modal or disablePointerDismissal props, unlike the plain Dialog. Escape still closes it; it renders with role="alertdialog".

PropTypeDefault
open / defaultOpenbooleanfalse
onOpenChange(open: boolean) => void—

AlertDialogContent

Content is centered by an AlertDialog.Viewport — long content scrolls the viewport, not the page.

PropTypeDefault
size"default" | "sm""default"

AlertDialogAction and AlertDialogCancel

Both are Close parts: they close the dialog regardless of which one is pressed, so attach the destructive handler via onClick on AlertDialogAction. Both expose Button’s variant/size — use variant="destructive" on the action for delete flows.

For async confirms that should keep the dialog open until the work finishes, control the dialog and cancel the close:

AlertDialogTrigger, AlertDialogHeader, AlertDialogMedia, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogOverlay, AlertDialogPortal

Styled parts. AlertDialogMedia renders an icon tile above the header (spans both text rows at the default size); the trigger accepts the render prop.

Was this page helpful?