Alert Dialog
A modal dialog used to convey critical information and require a user response before proceeding..
An accessible Alert Dialog component built with Radix UI
Installation
npx scrollx-ui@latest add alert-dialog
Usage
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
<AlertDialog>
<AlertDialogTrigger>Open</AlertDialogTrigger>
<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>
API Reference
AlertDialog
The root container for the alert dialog component.
AlertDialogTrigger
The button that triggers the alert dialog.
asChild
- Whentrue
, the trigger will be rendered as its child element.
AlertDialogContent
The container for alert dialog content.
className
- Optional class name for custom styling.
AlertDialogHeader
A container for grouping the title and description.
className
- Optional class name for styling the header section.
AlertDialogFooter
A container for grouping the dialog buttons.
className
- Optional class name for styling the footer section.
AlertDialogTitle
The title content of the alert dialog.
className
- Optional class name for styling the title.
AlertDialogDescription
The description content of the alert dialog.
className
- Optional class name for styling the description.
AlertDialogAction
The confirm button of the alert dialog.
className
- Optional class name for styling.- Contains animated hover effects using Framer Motion.
AlertDialogCancel
The cancel button of the alert dialog.
className
- Optional class name for styling.- Appears before the action button on mobile devices.