AlertDialog
Responsive Apple Liquid Glass alert dialog reproducing macOS 27's compact 26px-radius alert with pill buttons on desktop, and automatically adapting to iOS 27's 34px-radius centered Liquid Glass alert with 48px capsule buttons on mobile.
Crafted directly from Apple's official macOS 27 and iOS 27 Sketch UI Kits on top of @base-ui/react/alert-dialog for strict interruption confirmation semantics (blocks accidental backdrop dismissal and requires an explicit choice), adapting via native Tailwind md: breakpoints:
- Desktop (
>= 768px· macOS 27):26pxcorner radius,340px(300pxforsize="sm") Liquid Glass alert with left-aligned15pxtitle and13.5pxdescription, plus36pxfull-pill footer buttons (two equal-width side-by-side buttons, automatically stacking vertically for 3 or more). - Mobile (
< 768px· iOS 27): Centered floating34px-radius Liquid Glass alert with centered17pxtitle and description, upgraded to iOS 27's signature48pxfull-width capsule buttons stacked vertically (primary action on top, cancel below for one-handed reach).
Responsive Live Preview
Displays the macOS 27 alert by default; click the Mobile icon in the top-right preview toolbar to compare iOS 27's 34px radius and 48px capsule buttons, or drag the sidebar Glass Tint slider to inspect translucency levels:
Installation (Shadcn Registry)
# Install via the configured @apple-liquid namespace (automatically includes button and liquid-glass)
npx shadcn@latest add @apple-liquid/alert-dialog
# Or install directly via URL
npx shadcn@latest add https://your-domain.com/r/alert-dialog.jsonDestructive Confirmation
Pass variant="destructive" to <AlertDialogAction> for macOS 27's soft-red destructive pill button, paired with size="sm" and <AlertDialogMedia> to highlight irreversible actions:
Stacked Actions
When <AlertDialogFooter> contains 3 or more action buttons, the layout automatically switches from a 2-column row to a vertical stack (matching Apple 27's Sketch Stacked spec):
Usage
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from '@/components/ui/alert-dialog';
import { Button } from '@/components/ui/button';
export function Example() {
return (
<AlertDialog>
<AlertDialogTrigger render={<Button variant="destructive">Delete Backup</Button>} />
<AlertDialogContent size="sm">
<AlertDialogHeader>
<AlertDialogTitle>Permanently delete this backup?</AlertDialogTitle>
<AlertDialogDescription>
Historical snapshots cannot be recovered once deleted. This action cannot be undone.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Keep</AlertDialogCancel>
<AlertDialogAction variant="destructive">Delete</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
}Props API
AlertDialogContent
| Prop | Type | Default | Description |
|---|---|---|---|
glass | boolean | true | Liquid Glass material reacting to global glass tint; false renders the 100% opaque surface equivalent |
size | 'default' | 'sm' | 'default' | Desktop width: default is 340px, sm is 300px |
AlertDialogAction / AlertDialogCancel
| Prop | Type | Default | Description |
|---|---|---|---|
variant | ButtonProps['variant'] | Action: 'default' / Cancel: 'secondary' | Supports all Button semantic variants such as 'default', 'destructive', 'secondary' |
glass | boolean | true | Same as Button; automatically renders as Over-Glass flat fill inside the dialog |
disableMotion | boolean | false | Disable the button press spring animation |
Alert
Apple 27 inline alert banner with grouped surface, 0.5px hairline stroke, accent icon, 18px mobile ↔ 12px desktop corner radius, and an Apple Red tinted destructive variant.
AspectRatio
Unstyled layout utility for displaying images, videos, or cards at a fixed aspect ratio using native CSS aspect-ratio.