Dialog
A modal surface for focused decisions, confirmation flows, and short-form editing.
Dialog presents a modal surface that temporarily takes focus away from the page so the user can complete a focused task. It is built on Radix UI, which means escape handling, focus trapping, overlay semantics, and title/description relationships work the way assistive technology expects.
Use it for confirmations, short forms, and actions that should pause the surrounding workflow until the user responds. If the content only needs lightweight supporting context, use Popover instead.
Installation
npx @glass-ui-kit/cli add dialogUsage
Examples
Variants
Use the variant prop on DialogContent to tune the modal surface depth without changing its structure.
Width control
Use className on DialogContent when the layout needs a tighter or wider modal body.
Controlled
Use open and onOpenChange when another part of the interface needs to coordinate the modal state.
Styling
Dialog keeps the API small. Reach for variant on DialogContent first, use DialogHeader and DialogFooter to keep structure consistent, and use className as the escape hatch for modal width or internal spacing.
API Reference
Dialog
Accepts all Radix Dialog.Root props.
| Prop | Type |
|---|---|
defaultOpen | boolean |
open | boolean |
onOpenChange | (open: boolean) => void |
modal | boolean |
DialogTrigger / DialogClose
Accept all Radix trigger and close props.
| Prop | Type |
|---|---|
asChild | boolean |
disabled | boolean |
className | string |
DialogContent
| Prop | Type |
|---|---|
variant | "default" | "soft" | "strong" |
forceMount | boolean |
onEscapeKeyDown | (event: KeyboardEvent) => void |
onPointerDownOutside | (event: PointerDownOutsideEvent) => void |
className | string |
DialogContent defaults to a centered modal layout with max-w-lg. Use className to tune width without changing accessibility wiring.
DialogHeader / DialogFooter
Use these helpers to keep modal titles, descriptions, and action areas consistently spaced without adding custom layout wrappers every time.
DialogTitle / DialogDescription
Use these helpers whenever the modal needs a visible label or supporting text. Radix automatically wires them to the dialog surface so screen readers announce the modal clearly.