Skip to content

Dialog

A window overlaid on the page, rendering the content underneath inert.

Install

Bash
npx @madeui/cli add dialog

Usage

TSX
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from '@/components/ui/dialog';

Composition

TSX
<Dialog>
  <DialogTrigger />
  <DialogContent>
    <DialogHeader>
      <DialogTitle />
      <DialogDescription />
    </DialogHeader>
    <DialogFooter>
      <DialogClose />
    </DialogFooter>
  </DialogContent>
</Dialog>

Custom width

Override the content width with the style prop.

Scrollable content

Give DialogContent a maxHeight and wrap the long content in its own scrollable container — the header and footer stay put.

No close button

Set showCloseButton={false} and close the dialog through your own footer buttons instead.

API reference

Built on Base UI Dialog. The tables below cover the props this library adds or changes — every other prop is forwarded to the underlying Base UI part; see the Base UI Dialog API reference for the full list.

Dialog (Root)

PropTypeDefaultDescription
openboolean—Controlled open state.
defaultOpenbooleanfalse
onOpenChange(open: boolean) => void—

DialogContent

PropTypeDefaultDescription
showCloseButtonbooleantrueRenders an X close button in the top-right corner.
styleStyleXStyles—StyleX styles merged last — always win over the component’s own styles.

Styling

DialogContent, DialogOverlay, DialogHeader, DialogFooter, DialogTitle, DialogDescription accept style (StyleXStyles, merged last so caller overrides always win) plus all native props of the element they render.

DialogTrigger / DialogClose accept render: <DialogTrigger render={<Button />}>. Always include a DialogTitle for accessibility.

Theming note: dialogs portal to <body>, so apply colorScheme and any brand theme to <html>, not a wrapper element.

Was this page helpful?