Components

Dialog

A window overlaid on the page, holding focus until dismissed.

Installation

npx shadcn@latest add @blank/dialog

Usage

import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog"
<Dialog>
  <DialogTrigger asChild>
    <Button variant="outline">Open</Button>
  </DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Edit profile</DialogTitle>
      <DialogDescription>
        Changes are saved when you click Save.
      </DialogDescription>
    </DialogHeader>
    <DialogFooter>
      <DialogClose asChild>
        <Button variant="outline">Cancel</Button>
      </DialogClose>
      <Button>Save</Button>
    </DialogFooter>
  </DialogContent>
</Dialog>

Examples

showCloseButton moves the dismiss action from the corner into the footer. Use it for dialogs whose only action is closing.

Scrollable content

Give the content a max height and a three-row grid; the middle row scrolls while the header and footer stay in place.

API Reference

Dialog

Every Radix Dialog.Root prop: open, defaultOpen, onOpenChange, modal.

DialogContent

Every Radix Dialog.Content prop, plus:

PropTypeDefault
showCloseButtonbooleantrue

DialogFooter

Every div prop, plus:

PropTypeDefault
showCloseButtonbooleanfalse