- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Confirm Dialog
- Container
- Context Menu
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input Number
- Input OTP
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Message Scroller
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Tailwind Indicator
- Textarea
- Toggle
- Toggle Group
- Tooltip
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,Installation
pnpm slabui add alert-dialog
Usage
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog"<AlertDialog>
<AlertDialogTrigger render={<Button variant="outline" />}>
Show Dialog
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete your account
from our servers.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Continue</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>Composition
Use the following composition to build an AlertDialog:
AlertDialog
โโโ AlertDialogTrigger
โโโ AlertDialogContent
โโโ AlertDialogHeader
โ โโโ AlertDialogMedia
โ โโโ AlertDialogTitle
โ โโโ AlertDialogDescription
โโโ AlertDialogFooter
โโโ AlertDialogCancel
โโโ AlertDialogActionBasic
A basic alert dialog with a title, description, and cancel and continue buttons.
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,Small
Use the size="sm" prop to make the alert dialog smaller.
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,Media
Use the AlertDialogMedia component to add a media element such as an icon or image to the alert dialog.
import { CircleFadingPlusIcon } from "lucide-react"
import {
AlertDialog,
AlertDialogAction,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.
import { BluetoothIcon } from "lucide-react"
import {
AlertDialog,
AlertDialogAction,Danger
Use the AlertDialogAction component to add a danger action button to the alert dialog.
import { Trash2Icon } from "lucide-react"
import {
AlertDialog,
AlertDialogAction,API Reference
size
Use the size prop 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.