Dialog
A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.
Features
- Focus is automatically trapped.
- Works in an uncontrolled way by default.
- Can also be controlled.
Install the component from your command line.
Import the components and piece the parts together.
Create your styled dialog component from the dialog primitives.
Contains all the parts of a dialog.
Prop | Type | Default | Required |
---|---|---|---|
defaultOpen | boolean | ||
open | boolean | ||
onOpenChange | function | ||
id | string |
The button that opens the dialog.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | button |
A layer that covers the inert portion of the view when the dialog is open.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div | |
forceMount | boolean |
Contains content to be rendered in the open dialog.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div | |
forceMount | boolean | ||
onOpenAutoFocus | function | ||
onCloseAutoFocus | function | ||
onEscapeKeyDown | function | ||
onPointerDownOutside | function |
The button that closes the dialog.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | button |
Adheres to the Dialog WAI-ARIA design pattern.
Key | Description |
---|---|
Space | Opens/closes the dialog. |
Enter | Opens/closes the dialog. |
Tab | Moves focus to the next focusable element. |
Shift + Tab | Moves focus to the previous focusable element. |
Esc | Closes the dialog and moves focus to Dialog.Trigger . |