Skip to main content

Installation

Or use the CLI:

Usage

Component API

Dialog

The root dialog component built on Radix UI. Props:
  • open - Control dialog open state
  • onOpenChange - Callback when open state changes
  • defaultOpen - Initial open state
  • modal - Whether dialog is modal (default: true)

DialogTrigger

The element that opens the dialog. Props:
  • asChild - Compose with child element

DialogContent

The dialog content container. Props:
  • showCloseButton - Show close button (default: true)
  • onEscapeKeyDown - Callback when escape is pressed
  • onPointerDownOutside - Callback when clicking outside

DialogHeader

Container for title and description.

DialogTitle

The dialog title (required for accessibility).

DialogDescription

The dialog description.

DialogFooter

Container for dialog actions. Props:
  • showCloseButton - Show close button (default: false)

DialogClose

Closes the dialog.

Examples

Custom Close Button

Replace the default close control with your own button:

No Close Button

Hide the close button completely:

Scrollable Content

Long content can scroll while the header stays in view:
Keep actions visible while the content scrolls:

Controlled Dialog

Control the dialog open state:

Form Dialog

Dialog containing a form:

Accessibility

  • Built on Radix UI for full accessibility
  • Focus is trapped within the dialog
  • Escape key closes the dialog
  • Background content is inert
  • Screen reader compatible
  • ARIA labels and roles

API Reference

See the Base UI Dialog documentation for complete API details.