Skip to content
GitHub

Dialog

A dialog for displaying content.

Installation

Usage

Title and Description

<DialogHeader /> supports two usage patterns:

Using props

Pass title and description props directly to <DialogHeader />.

This approach does not require <DialogTitle /> or <DialogDescription /> components.

Using components

Alternatively, use <DialogTitle /> and <DialogDescription /> as children for more control.

Examples

With Scroll

Use <DialogBody /> to make the content area scrollable while keeping header and footer fixed.

No Close Button

Use the showCloseButton prop to hide the close button in the top right corner.

Close behavior

Use closeOnInteractOutside and closeOnEscape props to prevent closing on outside click and escape.

Open from Menu

Open a dialog imperatively from a menu item using the onClick handler.

Non-Modal

Use modal={false} to allow interaction with elements outside the dialog. Disables focus trapping and scroll prevention.

Initial Focus

Use initialFocusEl to control which element receives focus when the dialog opens.

Nested

Nest dialogs within one another.

Custom spacing

Use [--space:--spacing("value")] on <DialogContent /> to adjust internal padding (default --spacing(6)).

API Reference

Dialog

Root context provider. Controls open state and modal behavior.

DialogTrigger

Opens the dialog on click. Use asChild for custom trigger elements.

DialogContent

Holds the dialog panel. Supports size variants from sm to fullscreen.

DialogHeader

Header area for title and description. Accepts props or children.

DialogBody

Scrollable body content. Uses ScrollArea for overflow.

DialogFooter

Footer area for action buttons.

DialogTitle

Accessible title for the dialog. Announced to screen readers.

DialogDescription

Accessible description for the dialog. Announced to screen readers.

DialogClose

Closes the dialog on click. Use asChild for custom close elements.

DialogOverlay

Dimmed overlay behind the dialog panel.


For a complete list of props, see the Ark UI documentation.