ZaidanHomeDocsComponentsBlocksChartsTypesetCreate

Command Palette

Search for a command to run...

GitHub
New
Sections
  • Introduction
  • Components
  • Blocks
  • Installation
  • Customization
  • Dark Mode
  • Typeset
  • Zaidan Skills
  • FAQ
  • Roadmap
  • Changelog
Installation
  • Astro
  • Manual
  • Solid Start
  • TanStack Router
  • TanStack Start
  • Vite
Blocks
  • Data Grid
  • Event Calendar
  • Filters
  • Gantt
  • Image Crop
  • Kanban
  • Message Scroller
  • Questionnaire
  • Sortable
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Aspect Ratio
  • Attachment
  • Avatar
  • Badge
  • Breadcrumb
  • Bubble
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Collapsible
  • Combobox
  • Command
  • Context Menu
  • Dialog
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • Hover Card
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kbd
  • Label
  • Marker
  • Menubar
  • Message
  • Native Select
  • Navigation Menu
  • Pagination
  • Popover
  • Progress
  • Radio Group
  • Resizable
  • Scroll Area
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Spinner
  • Switch
  • Table
  • Tabs
  • Textarea
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip

Alert Dialog

A modal dialog that interrupts the user with important content and expects a response.

Kobalte
Kobalte

The Alert Dialog component is built on top of Kobalte Alert Dialog, which provides accessible modal and keyboard behavior for consequential actions.

Installation

pnpm dlx shadcn@latest add @zaidan/alert-dialog
npx shadcn@latest add @zaidan/alert-dialog
yarn dlx shadcn@latest add @zaidan/alert-dialog
bunx --bun shadcn@latest add @zaidan/alert-dialog

Usage

1
import {
2
AlertDialog,
3
AlertDialogAction,
4
AlertDialogCancel,
5
AlertDialogContent,
6
AlertDialogDescription,
7
AlertDialogFooter,
8
AlertDialogHeader,
9
AlertDialogTitle,
10
AlertDialogTrigger,
11
} from "~/components/ui/alert-dialog";
12
import { Button } from "~/components/ui/button";
1
<AlertDialog>
2
<AlertDialogTrigger as={Button} variant="outline">
3
Show Dialog
4
</AlertDialogTrigger>
5
<AlertDialogContent>
6
<AlertDialogHeader>
7
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
8
<AlertDialogDescription>
9
This action cannot be undone. This will permanently delete your account
10
from our servers.
11
</AlertDialogDescription>
12
</AlertDialogHeader>
13
<AlertDialogFooter>
14
<AlertDialogCancel>Cancel</AlertDialogCancel>
15
<AlertDialogAction>Continue</AlertDialogAction>
16
</AlertDialogFooter>
17
</AlertDialogContent>
18
</AlertDialog>

Composition

Use the following composition to build an AlertDialog:

AlertDialog
├── AlertDialogTrigger
└── AlertDialogContent
├── AlertDialogHeader
│ ├── AlertDialogMedia
│ ├── AlertDialogTitle
│ └── AlertDialogDescription
└── AlertDialogFooter
├── AlertDialogCancel
└── AlertDialogAction

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 prop on the AlertDialogContent component to control the size of the alert dialog. It accepts the following values:

PropTypeDefault
size"default" | "sm""default"

For all primitive props and keyboard interactions, see the Kobalte Alert Dialog API reference.

On This Page

  • Installation
  • Usage
  • Composition
  • Basic
  • Small
  • Media
  • Small with Media
  • Destructive
  • API Reference
    • size
Built by Kevin Abatan. The source code is available on GitHub.