Dialog
Dialogs inform users about a task and can contain critical information, require decisions, or involve multiple tasks.
DialogBackdrop API
Import
import * as Dialog from '@base_ui/react/Dialog';
const DialogBackdrop = Dialog.Backdrop;
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
className | func | string | - | Class names applied to the element or a function that returns them based on the component's state. |
keepMounted | bool | false | If |
render | element | func | - | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can useDialogBackdrop
to change the default props of this component with the theme.DialogClose API
Import
import * as Dialog from '@base_ui/react/Dialog';
const DialogClose = Dialog.Close;
Props of the native component are also available.
Name | Type | Description |
---|---|---|
className | func | string | Class names applied to the element or a function that returns them based on the component's state. |
render | element | func | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can useDialogClose
to change the default props of this component with the theme.DialogDescription API
Import
import * as Dialog from '@base_ui/react/Dialog';
const DialogDescription = Dialog.Description;
Props of the native component are also available.
Name | Type | Description |
---|---|---|
className | func | string | Class names applied to the element or a function that returns them based on the component's state. |
render | element | func | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can useDialogDescription
to change the default props of this component with the theme.DialogPopup API
Import
import * as Dialog from '@base_ui/react/Dialog';
const DialogPopup = Dialog.Popup;
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
className | func | string | - | Class names applied to the element or a function that returns them based on the component's state. |
container | HTML element | ref | - | The container element to which the popup is appended to. |
keepMounted | bool | false | If |
render | element | func | - | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can useDialogPopup
to change the default props of this component with the theme.DialogRoot API
Import
import * as Dialog from '@base_ui/react/Dialog';
const DialogRoot = Dialog.Root;
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
animated | bool | true | If |
defaultOpen | bool | - | Determines whether the dialog is initally open. This is an uncontrolled equivalent of the |
dismissible | bool | true | Determines whether the dialog should close when clicking outside of it. |
modal | bool | true | Determines whether the dialog is modal. |
onOpenChange | func | - | Callback invoked when the dialog is being opened or closed. |
open | bool | - | Determines whether the dialog is open. |
DialogTitle API
Import
import * as Dialog from '@base_ui/react/Dialog';
const DialogTitle = Dialog.Title;
Props of the native component are also available.
Name | Type | Description |
---|---|---|
className | func | string | Class names applied to the element or a function that returns them based on the component's state. |
render | element | func | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can useDialogTitle
to change the default props of this component with the theme.DialogTrigger API
Import
import * as Dialog from '@base_ui/react/Dialog';
const DialogTrigger = Dialog.Trigger;
Props of the native component are also available.
Name | Type | Description |
---|---|---|
className | func | string | Class names applied to the element or a function that returns them based on the component's state. |
render | element | func | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can useDialogTrigger
to change the default props of this component with the theme.