Dialog
rivelle/dialogFreeComponent
A modal surface that focuses an important task.
Live preview
live · rendered by the registry
Rendered by rivelle on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://rivelle.dev/r/dialog.jsonSource
1"use client"23import * as React from "react"4import * as DialogPrimitive from "@radix-ui/react-dialog"5import { X } from "lucide-react"67import { cn } from "@/lib/utils"89const Dialog = DialogPrimitive.Root10const DialogTrigger = DialogPrimitive.Trigger11const DialogClose = DialogPrimitive.Close12const DialogPortal = DialogPrimitive.Portal13function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>) { return <DialogPrimitive.Overlay data-slot="dialog-overlay" className={cn("fixed inset-0 z-50 bg-black/48 backdrop-blur-[5px] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className)} {...props} /> }14function DialogContent({ className, children, showCloseButton = true, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & { showCloseButton?: boolean }) { return <DialogPortal><DialogOverlay /><DialogPrimitive.Content data-slot="dialog-content" className={cn("fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-5 rounded-3xl border border-foreground/12 bg-background/96 p-7 shadow-[0_36px_100px_-28px_color-mix(in_oklch,var(--foreground)_38%,transparent),inset_0_1px_0_color-mix(in_oklch,var(--background)_78%,transparent)] backdrop-blur-xl outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-top-[48%]", className)} {...props}>{children}{showCloseButton && <DialogPrimitive.Close className="absolute right-5 top-5 grid size-8 place-items-center rounded-xl border border-transparent text-muted-foreground outline-none transition-[color,background-color,border-color,transform] hover:border-foreground/8 hover:bg-foreground/[.055] hover:text-foreground active:scale-90 focus-visible:ring-2 focus-visible:ring-ring/45"><X className="size-4" /><span className="sr-only">Close</span></DialogPrimitive.Close>}</DialogPrimitive.Content></DialogPortal> }15function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { return <div data-slot="dialog-header" className={cn("flex flex-col gap-2 text-center sm:text-left", className)} {...props} /> }16// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from rivelle
All 83 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | rivelle | Components | Free | 2 deps | |
| Alertalert | rivelle | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | rivelle | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | rivelle | Components | Free | 1 dep | |
| Avataravatar | rivelle | Components | Free | 1 dep | |
| Badgebadge | rivelle | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | rivelle | Components | Free | 2 deps | |
| Buttonbutton | rivelle | Components | Free | 2 deps |
