For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
0
Sponsor

Dialog

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

import { Button } from "@/components/button/button";
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,

Installation

$ pnpm dlx shadcn@latest add https://shadcn-cssinjs.vercel.app/r/dialog.json

Usage

import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog/dialog";
<Dialog>
  <DialogTrigger>Open</DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Are you absolutely sure?</DialogTitle>
      <DialogDescription>This action cannot be undone.</DialogDescription>
    </DialogHeader>
  </DialogContent>
</Dialog>

Composition

Use the following composition to build a Dialog:

Dialog
├── DialogTrigger
└── DialogContent
    ├── DialogHeader
    │   ├── DialogTitle
    │   └── DialogDescription
    └── DialogFooter
        └── DialogClose

Examples

Scrollable Content

Constrain the body height and let it scroll when content overflows.

import { Button } from "@/components/button/button";
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,

RTL

To enable right-to-left support, see the RTL guide.

"use client";

import { useTranslation } from "@/components/language-selector";
import type { Translations } from "@/components/language-selector";
import { Button } from "@/components/button/button";
import {

API Reference

See the Base UI documentation for the full API.