{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dialog",
  "title": "Dialog",
  "author": "Ballmac <https://ui.ballmac.com>",
  "description": "A Radix modal dialog with a blurred overlay, centered card surface that fits 360 px screens, header and footer parts, optional close button and animations.",
  "dependencies": [
    "radix-ui",
    "lucide-react"
  ],
  "devDependencies": [
    "tw-animate-css"
  ],
  "registryDependencies": [
    "utils",
    "https://ui.ballmac.com/r/i18n.json"
  ],
  "files": [
    {
      "path": "registry/ballmac/components/dialog.tsx",
      "content": "// Ballmac UI: Dialog. https://ui.ballmac.com/components/dialog\n// Based on shadcn/ui's Dialog (MIT, Copyright (c) 2023 shadcn), restyled with a blurred overlay and tw-animate-css transitions.\n\"use client\"\n\nimport * as React from \"react\"\nimport { XIcon } from \"lucide-react\"\nimport { Dialog as DialogPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { useMessages } from \"@/lib/ballmac/i18n\"\n\nfunction Dialog(props: React.ComponentProps<typeof DialogPrimitive.Root>) {\n  return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\nfunction DialogTrigger(props: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n  return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal(props: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n  return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose(props: React.ComponentProps<typeof DialogPrimitive.Close>) {\n  return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n  return (\n    <DialogPrimitive.Overlay\n      data-slot=\"dialog-overlay\"\n      className={cn(\n        \"fixed inset-0 z-50 bg-black/50 backdrop-blur-[2px]\",\n        \"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-reduce:animate-none\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\ntype DialogContentProps = React.ComponentProps<typeof DialogPrimitive.Content> & {\n  /** Render the top-right close button. */\n  showCloseButton?: boolean\n  /** Accessible name of the close button. */\n  closeLabel?: string\n}\n\nfunction DialogContent({\n  className,\n  children,\n  showCloseButton = true,\n  closeLabel,\n  ...props\n}: DialogContentProps) {\n  const msg = useMessages()\n  closeLabel ??= msg(\"dialog.closeLabel\", \"Close\")\n  return (\n    <DialogPortal>\n      <DialogOverlay />\n      <DialogPrimitive.Content\n        data-slot=\"dialog-content\"\n        className={cn(\n          \"fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-xl border bg-card p-5 text-card-foreground shadow-[0_24px_48px_-12px_rgb(0_0_0/0.25)] outline-none sm:p-6\",\n          \"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 duration-200 motion-reduce:animate-none\",\n          className\n        )}\n        {...props}\n      >\n        {children}\n        {showCloseButton ? (\n          <DialogPrimitive.Close\n            data-slot=\"dialog-close\"\n            aria-label={closeLabel}\n            className=\"absolute top-3 end-3 inline-flex size-8 items-center justify-center rounded-md text-muted-foreground outline-none transition-[color,background-color,box-shadow] duration-150 hover:bg-accent hover:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none [&_svg]:size-4\"\n          >\n            <XIcon aria-hidden=\"true\" />\n          </DialogPrimitive.Close>\n        ) : null}\n      </DialogPrimitive.Content>\n    </DialogPortal>\n  )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"dialog-header\"\n      className={cn(\"flex flex-col gap-1.5 text-start [[data-slot=dialog-content]:has(>[data-slot=dialog-close])_&]:pe-8\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"dialog-footer\"\n      className={cn(\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n  return (\n    <DialogPrimitive.Title\n      data-slot=\"dialog-title\"\n      className={cn(\"text-lg leading-tight font-semibold tracking-tight\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n  return (\n    <DialogPrimitive.Description\n      data-slot=\"dialog-description\"\n      className={cn(\"text-sm text-muted-foreground\", className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Dialog,\n  DialogClose,\n  DialogContent,\n  DialogDescription,\n  DialogFooter,\n  DialogHeader,\n  DialogOverlay,\n  DialogPortal,\n  DialogTitle,\n  DialogTrigger,\n  type DialogContentProps,\n}\n",
      "type": "registry:ui",
      "target": "@components/ballmac/dialog.tsx"
    }
  ],
  "meta": {
    "schema": 1,
    "tier": "free",
    "tags": [
      "dialog",
      "modal",
      "overlay",
      "radix"
    ],
    "version": "1.0.0",
    "updated": "2026-09-28",
    "ai": {
      "summary": "Modal window that traps focus. Compose Dialog > DialogTrigger (style it with buttonVariants) + DialogContent with DialogHeader (DialogTitle, DialogDescription) and DialogFooter; use DialogClose with buttonVariants for cancel buttons. Avoid asChild so the files also work in Base UI projects.",
      "whenToUse": [
        "Short forms that shouldn't leave the page (edit profile, rename)",
        "Confirming destructive actions",
        "Focused detail views"
      ],
      "whenNotToUse": [
        "Non-blocking messages (use a toast)",
        "Long multi-step flows (use a page)",
        "Content tied to a control that should stay visible (use a popover)"
      ],
      "composesWith": [
        "button",
        "input",
        "label",
        "textarea",
        "select"
      ],
      "a11y": [
        {
          "keys": "Escape",
          "action": "Closes the dialog"
        },
        {
          "keys": "Tab / Shift+Tab",
          "action": "Cycles focus inside the dialog"
        },
        {
          "keys": "Enter / Space on trigger",
          "action": "Opens the dialog"
        }
      ],
      "customization": [
        "showCloseButton (default true) and closeLabel for the X button",
        "DialogContent max-w-lg by default; override with className",
        "Always include a DialogTitle (use a sr-only class to hide it visually)",
        "Needs the tw-animate-css classes for the open and close animation"
      ]
    },
    "source": {
      "name": "shadcn/ui Dialog",
      "url": "https://github.com/shadcn-ui/ui",
      "license": "MIT",
      "copyright": "Copyright (c) 2023 shadcn",
      "modified": true
    },
    "examples": [
      "dialog-demo",
      "dialog-confirm"
    ],
    "url": "https://ui.ballmac.com/components/dialog"
  },
  "categories": [
    "primitives"
  ],
  "type": "registry:ui"
}