Modal

Radix Dialog with a sketch frame and a dimmed backdrop. Focus trap, Escape to close, and ARIA labelling are inherited. Opening fades the backdrop, eases the panel in, and draws the frame.

<Modal
  title="Scratch pad"
  trigger={<Button>Open modal</Button>}
  roughness={1.5}
>
  Content
</Modal>

CLI install

npx doodleui-react add modal

Usage

import { Modal, Button } from "doodleui-react";

<Modal
  title="Scratch pad"
  trigger={<Button>Open modal</Button>}
>
  Any content.
</Modal>

Compound exports (ModalRoot, ModalTrigger, ModalClose, ModalTitle, ModalDescription) are available if you need the full Radix structure.

Props

PropTypeDefaultNotes
triggerReactNodeundefinedElement that opens the dialog (Radix Trigger asChild).
titleReactNodeundefinedDialog title. A visually hidden title is used if omitted.
descriptionReactNodeundefinedOptional supporting copy.
open / onOpenChangeboolean / (open: boolean) => voiduncontrolledRadix controlled API. Focus trap and Escape are built in.
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.