Alert Dialog
The confirm / destructive-action variant of Dialog, built on Radix Alert Dialog. Unlike Dialog, there is no dismiss-on-outside-click or Escape by default — the user must pick an action.
<AlertDialog roughness={1.5}>
<AlertDialogTrigger asChild>
<Button variant="outline">Delete sketch</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete this sketch?</AlertDialogTitle>
<AlertDialogDescription>This can't be undone.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Delete</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>CLI install
npx doodleui-react add alert-dialog
Usage
import {
AlertDialog,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogCancel,
AlertDialogAction,
Button,
} from "doodleui-react";
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline">Delete sketch</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete this sketch?</AlertDialogTitle>
<AlertDialogDescription>This can't be undone.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Delete</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
AlertDialogAction renders an accent-filled Button; AlertDialogCancel renders an outline Button.
Props
| Prop | Type | Default | Notes |
|---|---|---|---|
| open / onOpenChange | boolean / (open: boolean) => void | uncontrolled | Radix controlled API. No outside-click or Escape dismiss by default. |
| AlertDialogAction / AlertDialogCancel | components | n/a | Pre-styled confirm (accent Button) and cancel (outline Button). |
| animate | boolean | true | Backdrop fade, panel enter/exit, and border draw-in on open. Overrides DoodleUIProvider. Reduced motion disables this unless the provider set forceAnimate. |
| roughness | number | 1.5 | How wobbly the stroke is. 0 is almost geometric. 3+ is messy. |
| seed | number | provider / random | Locks the sketch. Omit to follow SketchSeedProvider (Shuffle) or a mount-time random seed. |
| sketchColor | string | #1f1d1a | Stroke color. Also tints primary/accent fills where relevant. |
| className | string | undefined | Passed through to the root element. |
| style | CSSProperties | undefined | Passed through to the root element. |