Sizes
Dialog
A focused surface for a decision that needs the person’s attention.
Preview
Su uses the Quiet instrument direction. Use the mode switcher above to see light and dark.
Usage
- Use a dialog when the decision must be made before returning to the page.
- Give it a concise title and an explicit close action. Keep the main action inside the dialog.
- Its square stationary frame has a fine border and crisp contact edge. A page veil mutes the background; opening and closing are immediate.
- Trigger and Close share Button’s primary, secondary, quiet, and danger variants and 28px, 34px, and 40px sizes. Trigger defaults to secondary and Close to quiet.
- When the trigger is inside a finish island, pass an element in that island to Portal container.
API
| Prop | Values | Default |
|---|---|---|
| Root | open, defaultOpen, onOpenChange | closed |
| Trigger | button props, variant, size | secondary, default |
| Trigger / Close variant | primary, secondary, quiet, danger | — |
| Trigger / Close size | small (28px), default (34px), large (40px) | default |
| Portal | container | document body |
| Viewport / Popup | dialog layout and content props | — |
| Title / Description | content | — |
| Close | button props, variant, size | quiet, default |
Example
import { Dialog } from '@zao/react';
<Dialog.Root>
<Dialog.Trigger>Review changes</Dialog.Trigger>
<Dialog.Portal>
<Dialog.Backdrop />
<Dialog.Viewport>
<Dialog.Popup>
<Dialog.Title>Review changes</Dialog.Title>
<Dialog.Description>Check these settings before saving.</Dialog.Description>
<Dialog.Close>Cancel</Dialog.Close>
</Dialog.Popup>
</Dialog.Viewport>
</Dialog.Portal>
</Dialog.Root>Accessibility
Base UI moves focus into the dialog immediately, keeps focus inside, locks page scrolling, closes on Escape or outside press, and returns focus to the trigger. Title and description label the dialog. Opening and closing remain immediate with reduced motion. Reduced transparency uses an opaque page veil; the dialog surface is always opaque.