Dialog

Interrupts the page until the user answers. Focus moves in and is trapped, Escape closes, focus returns to the trigger, and the page behind stops scrolling.

Reach for it

A task that needs the page to wait: a form, a decision, a detail the flow depends on.

Not for

Confirming one action, which is a Confirm dialog, or a message, which is a Banner or a Toast.

Anatomy

The title is a required prop because a dialog with no accessible name is announced as nothing. The body and the footer are children rather than props, so the order of the buttons stays a decision per dialog.

Deleted 0 times

Sizes

Six steps, because a confirmation and a form with a table beside it are not the same dialog. Full is a share of the viewport rather than a width, for a dialog whose content decides how big it should be.

API reference

Dialog

Also takes the props of Base UI Dialog Root.

DialogTrigger

Also takes the props of Base UI Dialog Trigger.

DialogClose

Also takes the props of Base UI Dialog Close.

DialogContent

PropTypeDefaultDescription
title*string-
children*ReactNode-
closeLabel*string-Label for the close control. Passed in because the package ships no copy.
data-testidstring-Names the element for a test. Never rendered, never announced.
descriptionstring-Announced with the title. Use for the consequence of the action.
isTitleHiddenboolean-
isDescriptionHiddenboolean-
sizekeyof typeof SIZES-
initialFocusRefObject<HTMLElement | null>-The control that takes focus on open, such as a form's first field. The first tabbable element otherwise.

DialogBody

PropTypeDefaultDescription
children*ReactNode-

DialogFooter

PropTypeDefaultDescription
children*ReactNode-