--- title: Alert Dialog description: A modal dialog that interrupts the user with important content and expects a response. featured: true base: base component: true links: doc: https://base-ui.com/react/components/alert-dialog api: https://base-ui.com/react/components/alert-dialog#api-reference --- ## Installation Command Manual ```bash npx shadcn@latest add alert-dialog ``` Install the following dependencies: ```bash npm install @base-ui/react ``` Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx showLineNumbers import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog" ``` ```tsx showLineNumbers }> Show Dialog Are you absolutely sure? This action cannot be undone. This will permanently delete your account from our servers. Cancel Continue ``` ## Examples ### Basic A basic alert dialog with a title, description, and cancel and continue buttons. ### Small Use the `size="sm"` prop to make the alert dialog smaller. ### Media Use the `AlertDialogMedia` component to add a media element such as an icon or image to the alert dialog. ### Small with Media Use the `size="sm"` prop to make the alert dialog smaller and the `AlertDialogMedia` component to add a media element such as an icon or image to the alert dialog. ### Destructive Use the `AlertDialogAction` component to add a destructive action button to the alert dialog. ## API Reference ### size Use the `size` props on the `AlertDialogContent` component to control the size of the alert dialog. It accepts the following values: | Prop | Type | Default | | ------ | ------------------- | ----------- | | `size` | `"default" \| "sm"` | `"default"` | For more information about the other components and their props, see the [Base UI documentation](https://base-ui.com/react/components/alert-dialog#api-reference).