Elements

Components

Dialog

Dialog, dressed in the paper-and-ink system: the sheet dissolves in on elevation, the backdrop fades, and nested overlays stack through the shared z-index ladder. The parts — Root, Trigger, Backdrop, Positioner, Content, Title, Description, CloseTrigger.

#Basic usage

dialog/basic Vue React

#Props

#Backdrop

A styled part — no props of its own; it takes the anatomy's shared styling.

#CloseTrigger

A styled part — no props of its own; it takes the anatomy's shared styling.

#Content

A styled part — no props of its own; it takes the anatomy's shared styling.

#Description

A styled part — no props of its own; it takes the anatomy's shared styling.

#Positioner

A styled part — no props of its own; it takes the anatomy's shared styling.

#Root

PropTypeDefaultDescription
aria-labelstringHuman readable label for the dialog, in event the dialog title is not rendered
closeOnEscapebooleantrueWhether to close the dialog when the escape key is pressed
closeOnInteractOutsidebooleantrueWhether to close the dialog when the outside is clicked
defaultOpenbooleanfalseThe initial open state of the dialog when rendered. Use when you don't need to control the open state of the dialog.
defaultTriggerValuestring | nullThe initial trigger value when rendered. Use when you don't need to control the trigger value.
finalFocusEl() => HTMLElement | nullElement to receive focus when the dialog is closed
idstringThe unique identifier of the machine.
idsPartial<{ trigger: string; positioner: string; backdrop: string; content: string; closeTrigger: string; title: string; description: string; }>The ids of the elements in the dialog. Useful for composition.
initialFocusEl() => HTMLElement | nullElement to receive focus when the dialog is opened
modalbooleantrueWhether to prevent pointer interaction outside the element and hide all content below it
openbooleanThe controlled open state of the dialog
persistentElements(() => Element | null)[]Returns the persistent elements that: - should not have pointer-events disabled - should not trigger the dismiss event
preventScrollbooleantrueWhether to prevent scrolling behind the dialog when it's opened
restoreFocusbooleanWhether to restore focus to the element that had focus before the dialog was opened
role'dialog' | 'alertdialog'"dialog"The dialog's role
trapFocusbooleantrueWhether to trap focus inside the dialog when it's opened
triggerValuestring | nullThe value of the trigger that currently open the dialog

#Title

A styled part — no props of its own; it takes the anatomy's shared styling.

#Trigger

PropTypeDefaultDescription
valuestringThe value that identifies this specific trigger