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

PropTypeDefaultNotes
open / onOpenChangeboolean / (open: boolean) => voiduncontrolledRadix controlled API. No outside-click or Escape dismiss by default.
AlertDialogAction / AlertDialogCancelcomponentsn/aPre-styled confirm (accent Button) and cancel (outline Button).
animatebooleantrueBackdrop fade, panel enter/exit, and border draw-in on open. Overrides DoodleUIProvider. Reduced motion disables this unless the provider set forceAnimate.
roughnessnumber1.5How wobbly the stroke is. 0 is almost geometric. 3+ is messy.
seednumberprovider / randomLocks the sketch. Omit to follow SketchSeedProvider (Shuffle) or a mount-time random seed.
sketchColorstring#1f1d1aStroke color. Also tints primary/accent fills where relevant.
classNamestringundefinedPassed through to the root element.
styleCSSPropertiesundefinedPassed through to the root element.