compacto-ui

Search documentation

Jump to a page or a component.

Dialog

Header / body / footer anatomy baked in, so every dialog matches.

Preview

Installation

No install — ask an AI agent to copy this component from registry.json.

import { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "@/components/ui/dialog";

Notes

  • DialogContent carries no padding of its own. Header, Body and Footer each bring their own gutter and hairline dividers — that is what keeps every dialog in an app reading as the same object.
  • The close X lives in DialogHeader, not the panel, so it always sits on the title row rather than floating in a corner.
  • DialogFooter normalises direct Button children to the compact footer geometry, so callers keep using variant for role without restating size.
  • Turn off showCloseButton for dialogs whose footer already carries an explicit Cancel and must not be dismissed casually.
  • DialogTitle is required by Radix — it is the dialog's accessible name.
  • Default width is 400px. Pass w-[min(…px,92vw)] in className for a wider one.

Props

The props worth knowing. Everything else passes straight through to the underlying element, including className, which is merged last so it always wins.

PropTypeDefaultDescription
showCloseButton (Header)booleantrueRender the close X on the title row.
showCloseButton (Footer)booleanfalseAppend a plain Close button, for a dialog that only reports something.
closeLabelstring"Close"Copy and accessible name for either close control.