Dialog
Modal overlay for focused tasks. Dialog is the compound Root (Dialog.Trigger, Dialog.Popup, and the chrome parts Header, Title, Description, Actions, Close). Dialog.Popup is a native <dialog> opened with showModal(): it renders in place (no portal, no portalContainer), and its backdrop is the popup’s ::backdrop (there is no Backdrop part). The trigger must be a button (a Button or a host <button>): Dialog.Trigger merges onClick onto it — there is no render prop.
There is no @var-ui/astro Dialog — Astro and HTML previews show a static core-recipe approximation of the open chrome; full interaction is React-only.
You can nest Tooltip parts around Dialog.Trigger (Tooltip wraps the trigger, both stay inside Dialog) without a render prop.
State attributes, exit animation, and onOpenChange details are documented in Overlay lifecycle.
Examples
Compound parts
Compose Trigger, Popup, and chrome. Dialog is Root. Native props and ref on Dialog.Popup land on the <dialog>.
import { Button, Dialog } from '@var-ui/react';
<Dialog>
<Dialog.Trigger>
<Button>Open dialog</Button>
</Dialog.Trigger>
<Dialog.Popup>
<Dialog.Header>
<Dialog.Title>Notifications</Dialog.Title>
<Dialog.Close aria-label="Close" />
</Dialog.Header>
<Dialog.Description>You are all caught up.</Dialog.Description>
<Dialog.Actions>
<Dialog.Close>
<Button>Close</Button>
</Dialog.Close>
</Dialog.Actions>
</Dialog.Popup>
</Dialog>Title, description and actions
The usual arrangement for a short dialog.
import { Button, Dialog } from '@var-ui/react';
<Dialog>
<Dialog.Trigger>
<Button>Open dialog</Button>
</Dialog.Trigger>
<Dialog.Popup>
<Dialog.Header>
<Dialog.Title>Notifications</Dialog.Title>
<Dialog.Close />
</Dialog.Header>
<Dialog.Description>You are all caught up.</Dialog.Description>
<Dialog.Actions>
<Dialog.Close>
<Button>Close</Button>
</Dialog.Close>
</Dialog.Actions>
</Dialog.Popup>
</Dialog>Shorthand
Controlled dialogs that don’t need a trigger can pass title (and optionally
description) to Dialog.Root: it renders the popup, the header with a close button and
treats children as the body. size (sm | md | lg | xl, default xl) sets the
popup width on Dialog.Popup or in the shorthand, and onClose fires when the dialog
closes (unless the change was vetoed) — a convenience alongside onOpenChange.
const d = useDisclosure();
<Button onClick={d.show}>Add memory</Button>
<Dialog open={d.open} onOpenChange={d.setOpen} title="Add memory" size="lg">
<input />
</Dialog>Props
Accessibility
Built on the native <dialog> element. showModal() makes the rest of the page inert (Tab stays inside), moves focus into the dialog (use the autofocus attribute to pick the element) and returns it to the trigger on close. The title and description are wired to aria-labelledby / aria-describedby. Escape always reports escape-key; a backdrop press reports outside-press only while dismissable is true (the default); details.cancel() vetoes either.
Select, Combobox and Menu popups used inside a dialog render into the dialog automatically.