Dialog
Animated, accessible, and customizable Dialog component.
Install
pnpm dlx shadcn@latest add https://www.katestroyui.com/r/dialog
Usage
1import {2 Dialog,3 DialogTrigger,4 DialogContent,5 DialogHeader,6 DialogTitle,7 DialogDescription,8 DialogFooter,9 DialogClose,10} from "@/components/ui/dialog";1112<Dialog>13 <DialogTrigger asChild>14 <Button>Open Dialog</Button>15 </DialogTrigger>16 <DialogContent>17 <DialogHeader>18 <DialogTitle>Title</DialogTitle>19 <DialogDescription>Dialog description goes here.</DialogDescription>20 </DialogHeader>21 <div className="py-4">Content goes here.</div>22 <DialogFooter>23 <DialogClose asChild>24 <Button variant="outline">Close</Button>25 </DialogClose>26 <Button>Save</Button>27 </DialogFooter>28 </DialogContent>29</Dialog>
Props
Prop | Type | Description | Default |
---|---|---|---|
open | boolean | Controls whether the dialog is open (controlled usage) | - |
defaultOpen | boolean | Whether the dialog is open by default | false |
onOpenChange | (open: boolean) => void | Callback when open/close state changes | - |
children | React.ReactNode | Dialog content | - |