Dialog

A lighter, fully composable sibling to Modal. Modal is a single-prop, fixed-width, always-shadowed dialog with a forced close button. Dialog is the shadcn-style compound API — no forced width or shadow, and you build the header/footer yourself.

<Dialog roughness={1.5}>
  <DialogTrigger asChild>
    <Button variant="outline">Open dialog</Button>
  </DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Rename sketch</DialogTitle>
      <DialogDescription>Give this notebook page a new title.</DialogDescription>
    </DialogHeader>
    <Input defaultValue="Field notes" />
    <DialogFooter>
      <DialogClose asChild><Button variant="ghost">Cancel</Button></DialogClose>
      <DialogClose asChild><Button variant="primary">Save</Button></DialogClose>
    </DialogFooter>
  </DialogContent>
</Dialog>

CLI install

npx doodleui-react add dialog

Usage

import {
  Dialog,
  DialogTrigger,
  DialogContent,
  DialogHeader,
  DialogTitle,
  DialogDescription,
  DialogFooter,
  DialogClose,
  Button,
  Input,
} from "doodleui-react";

<Dialog>
  <DialogTrigger asChild>
    <Button variant="outline">Open dialog</Button>
  </DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Rename sketch</DialogTitle>
      <DialogDescription>Give this notebook page a new title.</DialogDescription>
    </DialogHeader>
    <Input defaultValue="Field notes" />
    <DialogFooter>
      <DialogClose asChild><Button variant="ghost">Cancel</Button></DialogClose>
      <DialogClose asChild><Button variant="primary">Save</Button></DialogClose>
    </DialogFooter>
  </DialogContent>
</Dialog>

Reach for Modal when you want a single all-in-one prop API; reach for Dialog when you need full control over the layout, or a smaller centered prompt.

Props

PropTypeDefaultNotes
open / onOpenChangeboolean / (open: boolean) => voiduncontrolledRadix controlled API. Focus trap and Escape are built in.
DialogContent contentStyleCSSPropertiesundefinedPadding for the inner content area. No forced width or shadow, unlike Modal.
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.