Dialog
A modal dialog component for displaying content in an overlay.
Structured
Use variant="structured" with contentPadding="regions" for new dialogs.
Dialog.Header holds the title row and Dialog.CloseButton. Dialog.Body
scrolls. Dialog.Footer holds the actions; wrap dismiss actions in
Dialog.Close asChild. Pass divider on the header and footer to separate
them from a form body.
When you render Dialog.Title and Dialog.Description, pass
hasAccessibleTitle and hasAccessibleDescription on Dialog.Content.
Controlled
Pass open and onOpenChange to open the dialog from your own state, for
example a confirmation before a destructive action.
Default Variant
Omitting variant gives the legacy shell. Use it only to match an existing
one-off layout. It has no regions and shows a close button in the top-right
corner; pass showCloseButton={false} to hide it. Its panel has a 520px
minimum width, so give it w-130 min-w-0 to let it shrink on small screens.
Usage
Without a visible Dialog.Title, pass aria-label on Dialog.Content. It
renders a screen-reader-only title.
Parts
Manages open state and modal behavior
Opens the dialog. Use asChild with a Button.
Portal, overlay, and panel
Title row, close button, and description
Scrollable main region
Right-aligned action row
Accessible dialog title
Accessible dialog description
Ghost icon button that closes the dialog. aria-label defaults to Close dialog.
Radix close primitive. Use asChild to make a footer button close the dialog.
Backdrop. Dialog.Content renders it for you.
Dialog.Root Properties
Controlled open state of the dialog
Callback fired when the open state changes
Default open state of the dialog
Default: false
Blocks interaction with content outside the dialog
Default: true
Dialog.Content Properties
Structured lays out Header, Body, and Footer. Default is the legacy shell.
Default: default
Structured only. md is 440px wide, lg is 640px with a 40vh minimum height, xl is 800px with a 60vh minimum height.
Default: md
Structured only. regions moves the padding onto Header, Body, and Footer so dividers run full width. Prefer regions; don't combine with className="p-0".
Default: content
Structured only. Gap between Header, Body, and Footer.
Default: default
Renders the top-right close icon. Defaults to true for the default variant and false for structured.
Set when children include Dialog.Title so no hidden title is added
Default: false
Set when children include Dialog.Description so no hidden description is added
Default: false
Render in the current context instead of a portal
Default: false
Do not render the dialog's own overlay
Default: false
Stacking layer. Use drawer to show the dialog above a drawer.
Default: dialog
Use a darker overlay background
Default: false
Additional CSS classes for the overlay
Additional CSS classes for the panel
Called when the dialog opens. Default focus is already prevented, so focus the element you want.
Called when focus returns to the trigger after the dialog closes
Called when Escape is pressed. Call event.preventDefault() to keep the dialog open.
Callback fired when clicking outside the dialog
Callback fired for any pointer or focus interaction outside the dialog. The event is a PointerDownOutsideEvent or a FocusOutsideEvent.
Region Properties
Dialog.Header and Dialog.Footer: draws a border between the region and the body
Default: false
Dialog.Body: fades the top and bottom edges while there is more to scroll. Structured only.
Default: false
Dialog.Body: classes for the scrolling viewport when scrollShadow is set
Dialog.Body: adds vertical padding so focus rings are not clipped under contentPadding="regions". Turn off when the body sets its own vertical padding.
Default: true
Dialog.Overlay Properties
Stacking layer relative to other modal surfaces
Blurs the content behind the dialog
Default: true
Uses a darker scrim
Default: false