Dialog

Asks for a decision or input in a modal window.

Installation

pnpm dlx shadcn@latest add @paneui/dialog

Usage

Composition

Examples

Destructive

With Form

No Close Button

Long Content

RTL

Motion

The backdrop fades and the popup scales from 96% and rises 8px over 250ms; it scales back down as it closes. With reduced motion it only fades.

Accessibility

Focus is trapped inside the popup and returns to the trigger on close. Esc and a backdrop click close it. DialogTitle and DialogDescription label the dialog.

API Reference

Built on the Dialog primitive. Only the props this library adds or changes are listed; everything else passes through.

Dialog

Re-export of the primitive root. Also accepts every prop of Dialog.Root.

open
boolean
Controlled open state.
defaultOpen= false
boolean
Initial state when uncontrolled.
onOpenChange
(open: boolean, eventDetails) => void
Called when the dialog opens or closes.
PropTypeDefaultDescription
openboolean—Controlled open state.
defaultOpenbooleanfalseInitial state when uncontrolled.
onOpenChange(open: boolean, eventDetails) => void—Called when the dialog opens or closes.

DialogTrigger

Re-export. Use render to make a Button the trigger. Also accepts every prop of Dialog.Trigger.

DialogContent

Portal, backdrop and centred popup (max-width 28rem, max-height the viewport minus 1rem each side). Taller content scrolls inside it with overscroll-contain, so the page doesn't scroll. Also accepts every prop of Dialog.Popup.

showClose= true
boolean
Render the close button. It stays pinned while long content scrolls and comes last in the focus order.
PropTypeDefaultDescription
showClosebooleantrueRender the close button. It stays pinned while long content scrolls and comes last in the focus order.
data-starting-style
Present while opening (scaled down, transparent).
data-ending-style
Present while closing.
Data attributeDescription
data-starting-stylePresent while opening (scaled down, transparent).
data-ending-stylePresent while closing.

DialogHeader

Stacks title and description, with right padding to clear the close button. Also accepts every prop of div.

DialogFooter

Right-aligned action row. Also accepts every prop of div.

DialogTitle

Also accepts every prop of Dialog.Title.

DialogDescription

Also accepts every prop of Dialog.Description.

DialogClose

Re-export. Closes the dialog when pressed. Also accepts every prop of Dialog.Close.