Alert

A macOS 27 alert: a narrow glass panel with a bold title, message and capsule buttons.

@cupertinoui/alert-dialogBase UI Alert Dialog Registry JSON

Installation

pnpm dlx shadcn@latest add @cupertinoui/alert-dialog

The first install also adds the macOS theme. See Installation to set up the registry.

Usage

import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@/components/ui/alert-dialog"

<AlertDialog>
  <AlertDialogTrigger>Restart…</AlertDialogTrigger>
  <AlertDialogContent>
    <AlertDialogHeader>
      <AlertDialogTitle>Restart your computer now?</AlertDialogTitle>
      <AlertDialogDescription>Unsaved changes will be lost.</AlertDialogDescription>
    </AlertDialogHeader>
    <AlertDialogFooter>
      <AlertDialogCancel>Cancel</AlertDialogCancel>
      <AlertDialogAction>Restart</AlertDialogAction>
    </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>

Examples

Stacked buttons

With three buttons or long labels, stack them. An app icon can go above the title.

Destructive

API Reference

Every part forwards the props of the underlying Base UI Alert Dialog part. The props below are the ones CupertinoUI adds or changes.

AlertDialogContent

PropTypeDescription
layout"side-by-side" | "stacked"
Default: "side-by-side"
Buttons in a row, or full-width and stacked.
size"default" | "sm"
Default: "default"
260 or 240pt wide.
classNamestringExtra classes, merged with the component's own.

AlertDialogAction / AlertDialogCancel

PropTypeDescription
variantButton variant
Default: "default" / "secondary"
The button style.
sizeButton size
Default: "lg"
Alerts use large capsule buttons.

AlertDialogMedia

The app icon above the title.

PropTypeDescription
classNamestringExtra classes, merged with the component's own.