Components

Dialog

Modal dialog with automatic naming and focus return

Overview

Dialog is a modal dialog built on the native dialog element. It renders through a Portal and opens with showModal(), so the page behind it cannot be clicked or reached with Tab.

  • Compound — Root, Title, Description, Content, Footer
  • Named by its title — Dialog.Title becomes the dialog's accessible name, and Dialog.Description its description. No extra props needed
  • Focus return — when the dialog closes, focus goes back to the element that opened it
  • Controlled — open state lives outside, through isOpen and onClose. Escape also calls onClose; the dialog stays open until you set isOpen to false
  • Motion — grows in from 96% with the backdrop fading in, and fades out before it leaves the page. With reduced motion, it only fades
  • Fixed width — 360px, centered on screen

Basic Usage

Screen readers announce this as a dialog named "Replace the recorded time?", followed by the description.

Alert Dialog

Use role="alertdialog" for errors and confirmations that cannot be undone. It looks the same; screen readers announce it more urgently.

Keyboard

KeyWhat happens
OpenFocus moves to the first focusable element inside the dialog
TabMoves between elements inside the dialog. The page behind is skipped
EscapeCloses the dialog and calls onClose
After closeFocus returns to the element that was focused before opening

Closing by setting isOpen to false does not call onClose; focus still returns.

Sub-components

Dialog (Root)

PropTypeDefaultRequiredDescription
isOpenboolean-YesWhether it is open. true opens it with showModal(). false plays the exit animation, removes it, and returns focus to the element that had focus before it opened.
onClose() => void-YesCalled on Escape (the browser close is prevented so the exit animation can run) and on the native close event. Set isOpen to false in it.
childrenReactNode-YesDialog.Title·Content·Description·Footer
role'dialog' | 'alertdialog''dialog'NoUse alertdialog for confirmations that cannot be undone (such as delete)
aria-labelstring-NoAccessible name. Leave it out to use Dialog.Title. Set it only when the name must differ from the title.
aria-describedbystring-NoIds of extra describing elements. Joined with the Dialog.Description id.
classNamestring-NoExtra CSS class

Dialog.Title

PropTypeDefaultRequiredDescription
childrenReactNode-YesTitle text
classNamestring-NoExtra CSS class

Dialog.Description

PropTypeDefaultRequiredDescription
childrenReactNode-YesDescription text
classNamestring-NoExtra CSS class

Dialog.Content

PropTypeDefaultRequiredDescription
childrenReactNode-YesBody content
classNamestring-NoExtra CSS class

Dialog.Footer

PropTypeDefaultRequiredDescription
childrenReactNode-YesUsually Buttons
classNamestring-NoExtra CSS class

Specification

base

상태요소속성값
enabledrootpadding$size.space.400
enabledrootborderRadius$size.radius.200
enabledrootgap$size.space.400
enabledrootwidth360px토큰 아님 — no sizing token scale
enabledtitletypography$text.bodyStrong
enabledtitletextAligncenter토큰 아님 — alignment is not tokenized
enableddescriptiontypography$text.bodyBase
enableddescriptioncolor$color.text.brand.secondary
enabledfootergap$size.space.400

Accessibility

  • Always render a Dialog.Title. Pass aria-label only when the name should differ from the visible title.
  • Extra description elements can be added with aria-describedby; they are read together with Dialog.Description.
  • ariaLabel and ariaDescribedby were renamed to the standard aria-label and aria-describedby.

Guidelines

  • Place a maximum of 2–3 buttons in the Footer
  • When isOpen={false}, the dialog is removed from the DOM