Alert Dialog
Ready
Modal dialog for important confirmations with multiple variants
Dialog Variants
Different styles for different contexts
With Custom Content
Add additional content inside the dialog
Usage
How to use the AlertDialog component
const [open, setOpen] = useState(false)
// Default Dialog
<AlertDialog
open={open}
onOpenChange={setOpen}
title="Are you absolutely sure?"
description="This action cannot be undone."
variant="default"
confirmText="Continue"
cancelText="Cancel"
onConfirm={() => console.log('Confirmed')}
onCancel={() => console.log('Cancelled')}
/>
// Danger Dialog
<AlertDialog
open={open}
onOpenChange={setOpen}
title="Delete Account"
description="This will permanently delete your account."
variant="danger"
confirmText="Delete"
onConfirm={() => console.log('Deleted')}
/>
// With Loading State
<AlertDialog
open={open}
onOpenChange={setOpen}
title="Processing..."
description="Please wait while we process your request."
variant="info"
loading={true}
onConfirm={() => console.log('Processing')}
/>API Reference
Props
open-boolean - Controls dialog visibilityonOpenChange-(open: boolean) => void - Open state change handlertitle-string - Dialog titledescription-string - Dialog descriptionvariant-"default" | "danger" | "warning" | "info" | "success" (default: "default")confirmText-string - Confirm button text (default: "Confirm")cancelText-string - Cancel button text (default: "Cancel")loading-boolean - Show loading spinner (default: false)onConfirm-() => void - Confirm button click handleronCancel-() => void - Cancel button click handlericon-Component - Custom icon componentchildren-ReactNode - Additional dialog contentFeatures
- 5 variants: default, danger, warning, info, success
- Loading states with spinner
- Keyboard navigation (Escape to close)
- Click outside to close
- Custom icons support
- Customizable button text
- Body scroll lock when open