Skip to content

Dialog

Free

A window over the page for one task, such as a short form or a detail view. The page behind waits until people close it.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 8, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Always render a DialogTitle: it gives the dialog its name. Render the trigger and the close buttons as a Button through render.

The sample also uses Button. One command adds them with this item:

release-notes-dialog.tsx

Dialog

PropTypeDefaultDescription
From Base UIDialog.RootBase UI docs
openboolean—Whether the dialog is currently open.
defaultOpenbooleanfalseWhether the dialog is initially open. To render a controlled dialog, use the open prop instead.
modal"trap-focus" | booleantrueDetermines if the dialog enters a modal state when open. - true: user interaction is limited to just the dialog: focus is trapped, document page scroll is locked, and pointer interactions on outside elements are disabled. - false: user interaction with the rest of the document is allowed. - 'trap-focus': focus is trapped inside the dialog, but document page scroll is not locked and pointer interactions outside of it remain enabled. When modal is true or 'trap-focus', render <Dialog.Close> inside <Dialog.Popup> so touch screen readers can escape the popup.

DialogTrigger

<button>
PropTypeDefaultDescription
classNamestring—
From Base UIDialog.TriggerBase UI docs
handleDialogHandle<Payload>—A handle to associate the trigger with a dialog. Can be created with the Dialog.createHandle method.
payloadPayload—A payload to pass to the dialog when it is opened.
idstring—ID of the trigger. In addition to being forwarded to the rendered element, it is also used to specify the active trigger for the dialog in controlled mode (with the DialogRoot triggerId prop).
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

DialogPortal

<div>
PropTypeDefaultDescription
From Base UIDialog.PortalBase UI docs
keepMountedbooleanfalseWhether to keep the portal mounted in the DOM while the popup is hidden.
container—A parent element to render the portal element into.
className—CSS class applied to the element, or a function that returns a class based on the component's state.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DialogOverlay

<div>
PropTypeDefaultDescription
classNamestring—
From Base UIDialog.BackdropBase UI docs
forceRenderbooleanfalseWhether the backdrop is forced to render even when nested.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DialogContent

<div>
PropTypeDefaultDescription
scroll"inside""outside"—
size"default""lg""sm""xl"—
classNamestring—
backdropbooleantrueDim the page under the dialog (Base UI Dialog.Backdrop). Default true.
showCloseButtonbooleantrueShow the close button (a 24px ghost icon button) in the top end corner. Default true.
closeLabelstring"Close"The accessible name of the close button. Translate it with the page.
portalProps—Other Base UI props of the inner parts. A className here adds to the component classes.
backdropPropsDialogOverlayProps—
viewportProps—
closeButtonProps—
From Base UIDialog.PopupBase UI docs
initialFocus—Determines the element to focus when the dialog is opened. By default, focus moves to the first tabbable element inside the popup, except when the dialog is opened by touch — then the popup itself is focused to avoid opening the virtual keyboard. - false: Do not move focus. - true: Move focus based on the default behavior (first tabbable element or popup). - RefObject: Move focus to the ref element. - function: Called with the interaction type (mouse, touch, pen, or keyboard). Return an element to focus, true to use the default behavior, null to fall back to the default behavior, or false/undefined to do nothing.
finalFocus—Determines the element to focus when the dialog is closed. - false: Do not move focus. - true: Move focus based on the default behavior (trigger or previously focused element). - RefObject: Move focus to the ref element. - function: Called with the interaction type (mouse, touch, pen, or keyboard). Return an element to focus, true to use the default behavior, null to fall back to the default behavior, or false/undefined to do nothing.
container—A parent element to render the portal element into.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DialogHeader

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DialogTitle

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DialogDescription

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DialogBody

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DialogFooter

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DialogClose

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use it for one task that needs the full attention of the user.
  • Always render a DialogTitle.
  • Put the Cancel (DialogClose) first in the footer and the main action last.
  • For a yes or no question before a destructive action, use an Alert Dialog.
EscCloses the dialog.
TabMoves the focus to the next element. The focus stays in the dialog.
ShiftTabMoves the focus to the previous element.

The window is a Base UI Dialog.Popup. DialogTitle is an h2 that names it (aria-labelledby), and DialogDescription describes it (aria-describedby). A screen reader reads both when the dialog opens.

The dialog is modal by default: the focus moves into it and stays in it until it closes. modal also takes false or "trap-focus". With scroll="outside", the popup itself gets the first focus.

The close button in the top end corner is a 24px ghost icon Button. Its name comes from closeLabel (default "Close"): translate it with the page. Each Button grows to a 44px touch target on a touch screen (hit-area).

When DialogBody scrolls and holds only text, give it tabIndex={0} and an aria-label, so a keyboard user can scroll it.

Open
overlay · 200ms · ease-panel (0.2, 0.4, 0.2, 1) · the panel fades in and scales from 95%, the backdrop fades in
Close
overlay-exit · 150ms · ease-out (0, 0, 0.2, 1) · the panel fades out and scales to 95%, the backdrop fades out
Child dialog opens
overlay · 200ms · ease-panel (0.2, 0.4, 0.2, 1) · the parent panel moves back 4% and up 8px
  1. AddedDialog.
Open the release