Dialog
A modal window that traps focus.
Staticimport { Dialog } from 'umbra-ui'
Props
Dialog
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | `DialogTrigger` and `DialogContent`. |
defaultOpen | boolean | false | Initial open state when uncontrolled. |
modal | boolean | true | When `false`, content behind stays interactive and focus is not trapped. |
onOpenChange | ((open: boolean) => void) | — | Called when the dialog opens or closes. |
open | boolean | — | Controlled open state. |
DialogContent
| Prop | Type | Default | Description |
|---|---|---|---|
title required | ReactNode | — | Dialog title. Required: it is the dialog's accessible name. |
closeLabel | string | Close | Accessible label for the close button. |
description | ReactNode | — | Supporting text under the title, announced as the dialog's description. |
hideClose | boolean | false | Hides the corner close button (Escape and outside click still close). |
size | "sm" | "md" | "lg" | md | Maximum width. |
Usage notes
DialogContent requires a title: it is the dialog's accessible name.
Accessibility
- Focus moves into the dialog, is trapped while open, and returns to the trigger on close.
- Escape and outside click close it.
descriptionis linked witharia-describedby.- Content behind is hidden from assistive tech while open.
Import
import { Dialog, DialogContent } from 'umbra-ui';
import 'umbra-ui/styles.css'; // once, at the root of your app