Dialog
Modal with backdrop, title, and footer.
Installation
Usage
Examples
Nested dialog
Opening the inner dialog hides the outer one. Closing it brings the outer back.
Scrollable content
Constrain long bodies with a max height so the dialog itself never overflows.
API reference
Dialog
| Prop | Type | Default |
|---|---|---|
openControlled open state. Use with onOpenChange. | boolean | - |
defaultOpenInitially open when uncontrolled. | boolean | false |
onOpenChangeCalled when the dialog opens or closes. | (open: boolean) => void | - |
onOpenChangeCompleteCalled after open or close animations finish. | (open: boolean) => void | - |
modalLimit interaction to the dialog. Trap-focus keeps outside interaction enabled. | boolean | 'trap-focus' | true |
disablePointerDismissalKeep the dialog open on outside clicks. | boolean | false |
DialogContent
| Prop | Type | Default |
|---|---|---|
showCloseButtonShow the corner X close button. | boolean | true |
renderPolymorphic render prop. Use to render a custom element instead of the default popup. | ReactElement | ((props) => ReactNode) | - |
classNameAdditional classes merged with the default content styles. | string | - |
DialogTrigger
| Prop | Type | Default |
|---|---|---|
renderRender a custom trigger element, e.g. render={<Button>Open</Button>}. | ReactElement | ((props) => ReactNode) | - |
disabledDisable the trigger. | boolean | false |
DialogClose
| Prop | Type | Default |
|---|---|---|
renderRender a custom close control. Must live inside the dialog. | ReactElement | ((props) => ReactNode) | - |
DialogHeader
| Prop | Type | Default |
|---|---|---|
classNameAdditional classes. Pairs with DialogTitle and DialogDescription. | string | - |
DialogTitle
| Prop | Type | Default |
|---|---|---|
classNameAdditional classes merged with the title styles. | string | - |
DialogDescription
| Prop | Type | Default |
|---|---|---|
classNameAdditional classes merged with the muted description styles. | string | - |