Skip to Content
✨ QuickCode UI keeps growing! More components, more features, and more ways to make your projects shine. Stay tuned & maybe… hire me or sponsor me 😉 
DocumentationAlertDialog

AlertDialog

A modal dialog that interrupts the user with important content and expects a response. Perfect for confirmations, warnings, and critical actions that require user acknowledgment.

Install Dependencies

npx
quickcode-ui add AlertDialog

Examples

Simple Alert Dialog

Controlled Alert Dialog with State

AlertDialog Props

PropTypeDefaultDescription
childrenReact.ReactNodeThe trigger and content elements
openbooleanControlled open state
defaultOpenbooleanfalseDefault open state for uncontrolled usage
onOpenChange(open: boolean) => voidCallback when open state changes

AlertDialogTrigger Props

PropTypeDefaultDescription
childrenReact.ReactNodeThe element that triggers the dialog
asChildbooleanfalseMerge props with child element
classNamestringAdditional CSS classes

AlertDialogContent Props

PropTypeDefaultDescription
childrenReact.ReactNodeDialog content
classNamestringAdditional CSS classes

AlertDialogHeader Props

PropTypeDefaultDescription
childrenReact.ReactNodeHeader content (Title and Description)
classNamestringAdditional CSS classes

AlertDialogFooter Props

PropTypeDefaultDescription
childrenReact.ReactNodeFooter content (Cancel and Action buttons)
classNamestringAdditional CSS classes

AlertDialogTitle Props

PropTypeDefaultDescription
childrenReact.ReactNodeThe dialog title text
classNamestringAdditional CSS classes

AlertDialogDescription Props

PropTypeDefaultDescription
childrenReact.ReactNodeThe dialog description text
classNamestringAdditional CSS classes

AlertDialogAction Props

Accepts all Button component props including:

PropTypeDefaultDescription
childrenReact.ReactNodeAction button content
variant"default" | "destructive" | "outline" | "secondary" | "ghost" | "link""default"Button variant style
size"default" | "sm" | "md" | "lg""sm"Button size
isLoadingbooleanfalseShow loading spinner
disabledbooleanfalseDisable the button
classNamestringAdditional CSS classes
onClick(e: React.MouseEvent<HTMLButtonElement>) => void | Promise<void>Called when button is clicked (supports async)

AlertDialogCancel Props

Accepts all Button component props including:

PropTypeDefaultDescription
childrenReact.ReactNodeCancel button content
variant"default" | "destructive" | "outline" | "secondary" | "ghost" | "link""outline"Button variant style
size"default" | "sm" | "md" | "lg""sm"Button size
disabledbooleanfalseDisable the button
classNamestringAdditional CSS classes
onClick(e: React.MouseEvent<HTMLButtonElement>) => voidCalled when button is clicked
Last updated on