Skip to Content
DocumentationAlert Dialog

Alert Dialog

A modal dialog that interrupts the user with important content and expects a response. Supports feedback variants (regular, emphasis, warning, error, success) with optional icon and tag slots.

Examples

Regular (Default)

The regular variant is used for standard information or confirmation dialogs. All examples now include an icon and a tag for a richer header.

Emphasis

The emphasis variant uses a secondary color scheme to highlight important or featured content.

Error

Use the error variant for destructive actions or critical failure notifications.

Warning

The warning variant is ideal for actions that require caution but are not necessarily destructive.

Success

The success variant confirms positive actions or successful completions.

With Close Button

Use showCloseButton on AlertDialogContent to render an × button in the top-right corner, allowing the user to dismiss the dialog without selecting an action.

API

AlertDialog

PropertyTypePossible valuesDefaultDescription
variantstring’regular’, ‘emphasis’, ‘warning’, ‘error’, ‘success’regularSets the feedback color scheme. Propagated via context to AlertDialogIcon, AlertDialogTag, and AlertDialogAction.
openbooleantrue, false-Controls the open state (controlled).
onOpenChange(open: boolean) => void--Called when the open state changes.
…propsAll Radix AlertDialog.Root props--All native properties of the Radix UI AlertDialog Root component.

AlertDialogTrigger

PropertyTypePossible valuesDefaultDescription
asChildbooleantrue, falsefalseWhen true, uses the child as the trigger.
…propsAll Radix AlertDialog.Trigger props--All native properties of the Radix UI AlertDialog Trigger component.

AlertDialogContent

PropertyTypePossible valuesDefaultDescription
showCloseButtonbooleantrue, falsefalseRenders an × button in the top-right corner that dismisses the dialog.
overlayClassNamestring--Additional CSS classes to apply to the overlay.
classNamestring--Additional CSS classes to apply to the content.
…propsAll Radix AlertDialog.Content props--All native properties of the Radix UI AlertDialog Content component.

AlertDialogIcon

Optional slot for a feedback icon above the title. Reads variant from AlertDialog context to apply the matching background and text color. When present, the header automatically centers all its content.

PropertyTypePossible valuesDefaultDescription
iconReactNode--The icon element to render. SVGs are sized to 32px automatically.
classNamestring--Additional CSS classes for the icon section container.

AlertDialogTag

Optional slot for a styled tag above the title. Reads variant from AlertDialog context automatically. Pass variant explicitly to override the inherited value.

PropertyTypePossible valuesDefaultDescription
variantstring’regular’, ‘emphasis’, ‘warning’, ‘error’, ‘success’Inherited from AlertDialogOverrides the color scheme inherited from the parent AlertDialog context.
childrenReactNode--The tag label text or content.
classNamestring--Additional CSS classes for the tag element.

AlertDialogAction

PropertyTypePossible valuesDefaultDescription
variantstringButton variants (‘regular’, ‘emphasis’, ‘error’, ‘success’, etc.)Inherited from AlertDialog variantThe visual variant of the button. When omitted, inherits from the parent AlertDialog variant. An explicit value always overrides the context.
sizestring’sm’, ‘md’, ‘lg’, ‘xl’lgThe size of the button.
…propsAll Radix AlertDialog.Action props--All native properties of the Radix UI AlertDialog Action component.

AlertDialogCancel

PropertyTypePossible valuesDefaultDescription
variantstringButton variants (‘regular’, ‘emphasis’, ‘error’, ‘success’, etc.)regular-softThe visual variant of the button.
sizestring’sm’, ‘md’, ‘lg’, ‘xl’lgThe size of the button.
…propsAll Radix AlertDialog.Cancel props--All native properties of the Radix UI AlertDialog Cancel component.
Last updated on