Alert Dialog

@/components/kamod-ui/alert-dialog

Installation

Import alert dialog primitives from `@/components/kamod-ui/alert-dialog`.

pnpm add @kamod-ch/ui
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogTitle, AlertDialogTrigger } from "@/components/kamod-ui/alert-dialog";

Usage

Compose Trigger (often asChild + Button), Content, Header (title + description), and Footer (Cancel + Action). Cancel and Action close the dialog on click.

import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "@/components/kamod-ui/alert-dialog";
<AlertDialog>
  <AlertDialogTrigger>Delete account</AlertDialogTrigger>
  <AlertDialogContent>
    <AlertDialogHeader>
      <AlertDialogTitle>Delete account?</AlertDialogTitle>
      <AlertDialogDescription>
        This action is permanent.
      </AlertDialogDescription>
    </AlertDialogHeader>
    <AlertDialogFooter>
      <AlertDialogCancel>Cancel</AlertDialogCancel>
      <AlertDialogAction>Continue</AlertDialogAction>
    </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>
<AlertDialog>
  <AlertDialogTrigger asChild>
    <Button variant="outline">Open</Button>
  </AlertDialogTrigger>
  <AlertDialogContent>
    <AlertDialogHeader>
      <AlertDialogTitle>Title</AlertDialogTitle>
      <AlertDialogDescription>Description</AlertDialogDescription>
    </AlertDialogHeader>
    <AlertDialogFooter>
      <AlertDialogCancel>Cancel</AlertDialogCancel>
      <AlertDialogAction>Continue</AlertDialogAction>
    </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>

Basic

Title, description, cancel and continue — matches the shadcn demo.

Small

Use size="sm" on AlertDialogContent for a narrower panel.

Media

AlertDialogMedia centers an icon or graphic above the title.

Small with media

Combine size="sm" with AlertDialogMedia for compact hardware-style prompts.

Destructive

Style media with destructive tokens; use variant="destructive" on AlertDialogAction and variant="outline" on Cancel.

API Reference

Props overview.

AlertDialog

Same as Dialog with lockBodyScroll; use for blocking confirmations.

PropTypeDefault
defaultOpenbooleanfalse
openboolean-
onOpenChange(open: boolean) => void-
classstring-

AlertDialogTrigger

PropTypeDefault
asChildbooleanfalse
classstring-

AlertDialogContent

PropTypeDefault
size"default" | "sm""default"
forceMountbooleanfalse
classstring-

AlertDialogHeader

PropTypeDefault
classstring-

AlertDialogMedia

Circular muted icon slot above title.

PropTypeDefault
classstring-

AlertDialogTitle

PropTypeDefault
classstring-

AlertDialogDescription

PropTypeDefault
classstring-

AlertDialogFooter

PropTypeDefault
classstring-

AlertDialogCancel

PropTypeDefault
variantButton variant"outline"
asChildbooleanfalse
classstring-

AlertDialogAction

PropTypeDefault
variantButton variant"default"
asChildbooleanfalse
classstring-

Accessibility Notes

Use Alert Dialog with clear labels, keyboard-friendly interactions and semantic structure.