dialog
amarjay-ui/dialogFreeComponent
Accessible modal dialog component.
Live preview
live · rendered by the registry
Rendered by amarjay-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.amarjay.com/r/dialog.jsonSource
1"use client"23import * as React from "react"4import { Dialog as DialogPrimitive } from "radix-ui"56import { cn } from "@/lib/utils"7import { Button } from "@/components/ui/button"8import { XIcon } from "lucide-react"910function Dialog({11 ...props12}: React.ComponentProps<typeof DialogPrimitive.Root>) {13 return <DialogPrimitive.Root data-slot="dialog" {...props} />14}1516function DialogTrigger({17 ...props18}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {19 return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />20}2122function DialogPortal({23 ...props24}: React.ComponentProps<typeof DialogPrimitive.Portal>) {25 return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />26}2728function DialogClose({29 ...props30}: React.ComponentProps<typeof DialogPrimitive.Close>) {31 return <DialogPrimitive.Close data-slot="dialog-close" {...props} />32}3334function DialogOverlay({35 className,36 ...props37}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {38 return (39 <DialogPrimitive.Overlay40 data-slot="dialog-overlay"41 className={cn(42 "fixed inset-0 isolate z-50 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",43 className44 )}45 {...props}46 />47 )48}4950function DialogContent({51 className,52 children,53 showCloseButton = true,54 ...props55}: React.ComponentProps<typeof DialogPrimitive.Content> & {56 showCloseButton?: boolean57}) {58 return (59 <DialogPortal>60 <DialogOverlay />61 <DialogPrimitive.Content62 data-slot="dialog-content"63 className={cn(64 "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",65 className66 )}67 {...props}68 >69 {children}70 {showCloseButton && (71 <DialogPrimitive.Close data-slot="dialog-close" asChild>72 <Button73 variant="ghost"74 className="absolute top-2 right-2"75 size="icon-sm"76 >77 <XIcon78 />79 <span className="sr-only">Close</span>80 </Button>81 </DialogPrimitive.Close>82// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from amarjay-ui
All 18 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| alertalert | amarjay-ui | Components | Free | 1 dep | |
| avataravatar | amarjay-ui | Components | Free | 1 dep | |
| badgebadge | amarjay-ui | Components | Free | 2 deps | |
| buttonbutton | amarjay-ui | Components | Free | 2 deps | |
| cardcard | amarjay-ui | Components | Free | no deps | |
| chartchart | amarjay-ui | Components | Free | 1 dep | |
| context-menucontext-menu | amarjay-ui | Components | Free | 2 deps | |
| dropdown-menudropdown-menu | amarjay-ui | Components | Free | 2 deps |
