Components

Dialog

A modal dialog for confirmations, forms, and focused tasks. Includes backdrop, keyboard dismissal, and focus trapping.

Basic usage

Compose with DialogTrigger, DialogContent, DialogHeader, and DialogFooter.

Controlled

Pass open and onOpenChange for full control.

Sizes

With form

Dialog Props

PropTypeDefaultDescription
openbooleanControlled open state.
onOpenChange(open: boolean) => voidCallback when open state changes.
childrenrequiredReact.ReactNodeDialog trigger and content.

DialogContent Props

PropTypeDefaultDescription
size'sm' | 'md' | 'lg' | 'xl''md'Max-width of the dialog.
classNamestringAdditional Tailwind classes.

Accessibility

  • Uses role="dialog" and aria-modal="true".
  • Escape key closes the dialog.
  • Clicking backdrop closes the dialog.
  • Body scroll is locked when open.
  • Close button has aria-label="Close dialog".