React
Usage
Examples
Use the size prop to change the size of the dialog component.
React
Cover
Use the size="cover" prop to make the dialog component cover the entire screen while revealing a small portion of the page behind.
React
Fullscreen
Use the size="full" prop to make the dialog component take up the entire screen.
React
Responsive Size
Use responsive values for the size prop to make the dialog adapt to different screen sizes.
We recommend using exact breakpoints values instead of using a base to ensure styles are properly contained.
React
Placements
Use the placement prop to change the placement of the dialog component.
React
Controlled
Use the open and onOpenChange prop to control the visibility of the dialog component.
Nested Dialogs
You can nest dialogs by using the Dialog.Root component inside another Dialog.Root component.
React
Initial Focus
Use the initialFocusEl prop to set the initial focus of the dialog component.
React
Inside Scroll
Use the scrollBehavior=inside prop to change the scroll behavior of the dialog when its content overflows.
React
Outside Scroll
Use the scrollBehavior=outside prop to change the scroll behavior of the dialog when its content overflows.
React
Motion Preset
Use the motionPreset prop to change the animation of the dialog component.
React
Alert Dialog
Set the role: "alertdialog" prop to change the dialog component to an alert
dialog.
React
Non-Modal Dialog
We don't recommend using a non-modal dialog due to the accessibility concerns they present. In event you need it, here's what you can do:
- set the
modalprop tofalse - set
pointerEventstononeon theDialog.Positionercomponent - (optional)set the
closeOnInteractOutsideprop tofalse
React