StorybookGitHub

Dialog

A window overlaid on either the primary window or another dialog window.

Installation

npx shadcn@latest add https://reactdocs.canceydejean.dev/r/dialog.json

Usage

Use dialogs for focused tasks that keep the user in context.

import { Button } from "@/components/button/button";
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/dialog/dialog";

export function Example() {
  return (
    <Dialog>
      <DialogTrigger render={<Button variant="outline" />}>
        Open Dialog
      </DialogTrigger>
      <DialogContent>
        <DialogHeader>
          <DialogTitle>Edit profile</DialogTitle>
          <DialogDescription>
            Make changes to your profile here. Click save when you are done.
          </DialogDescription>
        </DialogHeader>
        <DialogFooter>
          <DialogClose render={<Button variant="outline" />}>
            Cancel
          </DialogClose>
          <Button type="submit">Save changes</Button>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  );
}

Set showCloseButton={false} on DialogContent to hide the corner X. Pass showCloseButton on DialogFooter for a default footer close action.