AlertDialog
AlertDialog makes the user confirm or cancel before an action with serious results, such as deleting data. For lower-stakes modal tasks, use Dialog. For edge panels, use Sheet, or Drawer for drag-to-dismiss.
Installation
Run npx nxds-cli@latest init first if nxds isn’t set up in your app yet. See Install.
Usage
Composition
Examples
Destructive
Confirm a permanent delete with a destructive action button.
Centered
Center the header and stack full-width actions with variant="center".
Props
AlertDialog
AlertDialog adds no props of its own; it accepts the props of the element or primitive it wraps.
AlertDialogAction
| Prop | Type | Default | Description |
|---|---|---|---|
size | "default" | "sm" | "lg" | "icon-sm" | "icon" | "icon-lg" | null | "default" | No description |
variant | "link" | "default" | "error" | "destructive" | "outline" | "dashed" | "secondary" | "ghost" | null | "default" | No description |
AlertDialogBody
AlertDialogBody adds no props of its own; it accepts the props of the element or primitive it wraps.
AlertDialogCancel
| Prop | Type | Default | Description |
|---|---|---|---|
size | "default" | "sm" | "lg" | "icon-sm" | "icon" | "icon-lg" | null | "default" | No description |
variant | "link" | "default" | "error" | "destructive" | "outline" | "dashed" | "secondary" | "ghost" | null | "outline" | No description |
AlertDialogContent
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "center" | "default" | Layout. |
AlertDialogDescription
AlertDialogDescription adds no props of its own; it accepts the props of the element or primitive it wraps.
AlertDialogFooter
AlertDialogFooter adds no props of its own; it accepts the props of the element or primitive it wraps.
AlertDialogHeader
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "center" | null | "default" | No description |
AlertDialogOverlay
AlertDialogOverlay adds no props of its own; it accepts the props of the element or primitive it wraps.
AlertDialogPortal
AlertDialogPortal adds no props of its own; it accepts the props of the element or primitive it wraps.
AlertDialogTitle
AlertDialogTitle adds no props of its own; it accepts the props of the element or primitive it wraps.
AlertDialogTrigger
AlertDialogTrigger adds no props of its own; it accepts the props of the element or primitive it wraps.
This example also needs: Button.
Installation
Install these components first:
Copy and paste the following code into your project.
components/alert-dialog/AlertDialogAction.vue components/alert-dialog/AlertDialogBody.vue components/alert-dialog/AlertDialogCancel.vue components/alert-dialog/AlertDialogContent.vue components/alert-dialog/AlertDialogDescription.vue components/alert-dialog/AlertDialogFooter.vue components/alert-dialog/AlertDialogHeader.vue components/alert-dialog/AlertDialogOverlay.vue components/alert-dialog/AlertDialogTitle.vue components/alert-dialog/index.ts components/overlay-layout/overlay-layout.ts Keep each file at the path shown above it.
Paths are relative to
packages/vue/src/. Keep the same folders under your@/root, and the imports between files work without edits.
Usage
Examples
Destructive
Confirm a permanent delete with a destructive action button.
Centered
Center the header and stack full-width actions with variant="center".
Props
AlertDialogAction
| Prop | Type | Default | Description |
|---|---|---|---|
size | "default" | "sm" | "lg" | "icon-sm" | "icon" | "icon-lg" | null | "default" | No description |
variant | "default" | "destructive" | "error" | "outline" | "dashed" | "secondary" | "ghost" | "link" | null | "default" | No description |
AlertDialogBody
AlertDialogBody adds no props of its own; it accepts the props of the element or primitive it wraps.
AlertDialogCancel
| Prop | Type | Default | Description |
|---|---|---|---|
size | "default" | "sm" | "lg" | "icon-sm" | "icon" | "icon-lg" | null | "default" | No description |
variant | "default" | "destructive" | "error" | "outline" | "dashed" | "secondary" | "ghost" | "link" | null | "outline" | No description |
AlertDialogContent
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "center" | "default" | Layout. |
AlertDialogDescription
AlertDialogDescription adds no props of its own; it accepts the props of the element or primitive it wraps.
AlertDialogFooter
AlertDialogFooter adds no props of its own; it accepts the props of the element or primitive it wraps.
AlertDialogHeader
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "center" | null | "default" | No description |
AlertDialogOverlay
AlertDialogOverlay adds no props of its own; it accepts the props of the element or primitive it wraps.
AlertDialogTitle
AlertDialogTitle adds no props of its own; it accepts the props of the element or primitive it wraps.