ui
Alert Dialog
A modal dialog that interrupts the user with important content and expects a response.
1. Import
Import the alert dialog components from the design system.
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/design-system/components/ui/alert-dialog"2. Props
AlertDialog component props.
| Prop | Type | Default |
|---|---|---|
| open | boolean | -- |
| onOpenChange | (open: boolean) => void | -- |
| className | string | -- |
3. Usages
Common alert dialog patterns and configurations.
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/design-system/components/ui/alert-dialog";
import { Button } from "@/design-system/components/ui/button";
export function Example() {
return (
<AlertDialog>
<AlertDialogTrigger render={<Button variant="destructive">Delete account</Button>} />
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete your account
and remove your data from our servers.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Continue</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
}