Umbra UI

Dialog

A modal window that traps focus.

Staticimport { Dialog } from 'umbra-ui'

Props

Dialog

PropTypeDefaultDescription
children ReactNode—`DialogTrigger` and `DialogContent`.
defaultOpen booleanfalseInitial open state when uncontrolled.
modal booleantrueWhen `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

PropTypeDefaultDescription
title requiredReactNode—Dialog title. Required: it is the dialog's accessible name.
closeLabel stringCloseAccessible label for the close button.
description ReactNode—Supporting text under the title, announced as the dialog's description.
hideClose booleanfalseHides the corner close button (Escape and outside click still close).
size "sm" | "md" | "lg"mdMaximum 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.
  • description is linked with aria-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