🛠️

Guide to shadcn/ui Components

Oct 28, 2024

Dialog - shadcn/ui

Visit shadcn/ui

Overview

  • Source: shadcn/ui
  • Documentation, Components, Blocks, Charts, Themes, Examples, Colors available.
  • Social Links: GitHub, Twitter

Getting Started

Installation

Components

Dialog Component

Installation

  • Use CLI or Manual installation: npx shadcn@latest add dialog

Usage

  • Import components from @/components/ui/dialog:

    import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog"
  • Example usage:

    <Dialog> <DialogTrigger>Open</DialogTrigger> <DialogContent> <DialogHeader> <DialogTitle>Are you absolutely sure?</DialogTitle> <DialogDescription> This action cannot be undone. This will permanently delete your account and remove your data from our servers. </DialogDescription> </DialogHeader> </DialogContent> </Dialog>

Examples

  • Custom close button example available.

Notes

  • To use Dialog within a Context Menu or Dropdown Menu, wrap the menu in Dialog.
  • Example provided for a contextual menu within a dialog.

Additional Information

  • Deployment on Vercel supported.
  • Trusted by companies like OpenAI, Sonos, Chick-fil-A.
  • Developed by shadcn. Source code on GitHub.

Key Links