Shadcn UI Components

Dialog

A modal dialog interrupts the user with important content and expects a response. Built on Radix UI Dialog primitive with full accessibility support.


Dialog Examples

Installation

# The component is already installed at:
# src/components/ui/shadcn/dialog.tsx

Usage

import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from '@/components/ui/shadcn/dialog'

export function DialogDemo() {
  return (
    <Dialog>
      <DialogTrigger>Open</DialogTrigger>
      <DialogContent>
        <DialogHeader>
          <DialogTitle>Dialog Title</DialogTitle>
          <DialogDescription>
            Dialog description goes here.
          </DialogDescription>
        </DialogHeader>
      </DialogContent>
    </Dialog>
  )
}

Components

ComponentDescription
DialogThe root component
DialogTriggerOpens the dialog when clicked
DialogContentThe dialog content container
DialogHeaderContains the title and description
DialogTitleThe title of the dialog
DialogDescriptionDescribes the dialog purpose
DialogFooterContains action buttons
DialogCloseCloses the dialog
Previous
Context Menu
Next
Drawer