doodle-ui

Modal

Radix Dialog with a sketch frame and a dimmed backdrop. Focus trap, Escape to close, and ARIA labelling are inherited.

<Modal
  title="Scratch pad"
  trigger={<Button>Open modal</Button>}
  roughness={1.5}
>
  Content
</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.
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.