Faber UI
Components

Dialog

A modal window layered above the page content.

Dialog is built on the Base UI Dialog primitive. It renders a centered modal with a backdrop overlay and an optional close button.

Installation

Terminal
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/dialog.json

Usage

typescript
"use client";

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

export default function Example() {
  return (
    <Dialog>
      <DialogTrigger render={<Button>Open</Button>} />
      <DialogContent>
        <DialogHeader>
          <DialogTitle>Title</DialogTitle>
          <DialogDescription>Description</DialogDescription>
        </DialogHeader>
      </DialogContent>
    </Dialog>
  );
}

Examples

Confirmation dialog

Controlled usage

Pass open and onOpenChange to control the dialog programmatically:

typescript
const [open, setOpen] = useState(false);

<Dialog open={open} onOpenChange={setOpen}>
  <DialogContent>...</DialogContent>
</Dialog>

Components

ComponentDescription
DialogRoot. Accepts open, onOpenChange, defaultOpen.
DialogTriggerThe element that opens the dialog. Use render to compose.
DialogContentThe popup. Accepts showCloseButton (default true).
DialogHeaderTop section with title and description.
DialogFooterBottom section for actions. Accepts showCloseButton.
DialogTitleAccessible title.
DialogDescriptionMuted description.
DialogCloseCloses the dialog. Use render to compose with a button.

Changelog

  1. v0.3.0Popover, DropdownMenu, ContextMenu, Menubar, Select, Combobox, HoverCard, Tooltip, Dialog and AlertDialog enter and exit with interruptible transitions on the kit easing tokens, and tw-animate-css is no longer a depen…minor
  2. v0.1.0Restore open and close animations on every menu-family popup.patch
Full Dialog history

Last updated on

On this page