{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dialog",
  "type": "registry:ui",
  "title": "Dialog",
  "description": "A modal window for a focused task, like editing a record. Blocks the page until closed.",
  "dependencies": [
    "lucide-react@^1.48.0",
    "radix-ui@^1.6.7"
  ],
  "registryDependencies": [
    "https://blank.vageshwar.dev/r/theme.json",
    "https://blank.vageshwar.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "ui/dialog.tsx",
      "type": "registry:ui",
      "content": "// BlankUI: dialog. Managed by BlankUI. Read dialog.md before editing. The title is a prop on DialogContent, on purpose.\nimport type { ComponentProps, ReactNode } from \"react\"\nimport { Dialog as DialogPrimitive, VisuallyHidden } from \"radix-ui\"\nimport { X } from \"lucide-react\"\nimport { cn } from \"@/lib/utils\"\n\n/**\n * A modal window. Use `open` and `onOpenChange` to control it, or let DialogTrigger open it.\n *\n * @example\n * <Dialog>\n *   <DialogTrigger asChild>\n *     <Button>Edit profile</Button>\n *   </DialogTrigger>\n *   <DialogContent title=\"Edit profile\" description=\"Changes are saved when you click Save.\">\n *     <Stack gap={4}>...</Stack>\n *     <DialogFooter>\n *       <DialogClose asChild><Button variant=\"outline\">Cancel</Button></DialogClose>\n *       <Button type=\"submit\">Save</Button>\n *     </DialogFooter>\n *   </DialogContent>\n * </Dialog>\n */\nexport function Dialog(props: ComponentProps<typeof DialogPrimitive.Root>) {\n  return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\n/** Opens the dialog. Use `asChild` with a Button. */\nexport function DialogTrigger(props: ComponentProps<typeof DialogPrimitive.Trigger>) {\n  return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\n/** Closes the dialog. Use `asChild` with a Button. */\nexport function DialogClose(props: ComponentProps<typeof DialogPrimitive.Close>) {\n  return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nexport interface DialogContentProps extends Omit<\n  ComponentProps<typeof DialogPrimitive.Content>,\n  \"title\"\n> {\n  /** Required. The dialog heading, also used as its accessible name. */\n  title: ReactNode\n  /** Short text under the title, also used as the accessible description. */\n  description?: ReactNode\n  /** Hide the title visually but keep it for screen readers. */\n  hideTitle?: boolean\n  /** Show the X button in the corner. Defaults to `true`. */\n  showCloseButton?: boolean\n  /** Width. Defaults to `md`. */\n  size?: \"sm\" | \"md\" | \"lg\"\n}\n\nconst sizeClass = { sm: \"max-w-sm\", md: \"max-w-lg\", lg: \"max-w-2xl\" } as const\n\n/** The dialog window. Renders the title and description for you. */\nexport function DialogContent({\n  title,\n  description,\n  hideTitle = false,\n  showCloseButton = true,\n  size = \"md\",\n  className,\n  children,\n  ...props\n}: DialogContentProps) {\n  const heading = (\n    <DialogPrimitive.Title className=\"font-heading text-lg leading-tight font-semibold\">\n      {title}\n    </DialogPrimitive.Title>\n  )\n  return (\n    <DialogPrimitive.Portal>\n      <DialogPrimitive.Overlay\n        data-slot=\"dialog-overlay\"\n        className=\"fixed inset-0 z-50 bg-overlay motion-safe:data-[state=open]:animate-fade-in\"\n      />\n      <DialogPrimitive.Content\n        data-slot=\"dialog-content\"\n        // Without a description, opt out of Radix's missing-description warning.\n        {...(description ? {} : { \"aria-describedby\": undefined })}\n        className={cn(\n          \"fixed inset-x-4 top-1/2 z-50 mx-auto flex max-h-9/10 -translate-y-1/2 flex-col gap-4 overflow-y-auto rounded-lg border bg-surface-raised p-6 text-foreground shadow-lg motion-safe:data-[state=open]:animate-scale-in\",\n          sizeClass[size],\n          className,\n        )}\n        {...props}\n      >\n        <div className=\"flex flex-col gap-1.5 pr-6\">\n          {hideTitle ? <VisuallyHidden.Root>{heading}</VisuallyHidden.Root> : heading}\n          {description && (\n            <DialogPrimitive.Description className=\"text-sm text-muted-foreground\">\n              {description}\n            </DialogPrimitive.Description>\n          )}\n        </div>\n        {children}\n        {showCloseButton && (\n          <DialogPrimitive.Close\n            className=\"absolute top-4 right-4 cursor-pointer rounded-sm p-1 text-muted-foreground hover:bg-surface-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring\"\n            aria-label=\"Close\"\n          >\n            <X className=\"size-4\" aria-hidden=\"true\" />\n          </DialogPrimitive.Close>\n        )}\n      </DialogPrimitive.Content>\n    </DialogPrimitive.Portal>\n  )\n}\n\n/** Buttons at the bottom of the dialog. The main action goes last. */\nexport function DialogFooter({ className, ...props }: 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"
    },
    {
      "path": "ui/dialog.md",
      "type": "registry:ui",
      "content": "---\nname: dialog\ntitle: Dialog\ndescription: A modal window for a focused task, like editing a record. Blocks the page until closed.\ncategory: overlay\nwhenToUse:\n  - A short focused task, like editing a profile or creating an item.\n  - Content that needs the user's full attention before going back to the page.\nwhenNotToUse:\n  - when: Asking the user to confirm a destructive or important action.\n    use: alert-dialog\n  - when: Long forms, filters or navigation that work better at the edge of the screen.\n    use: sheet\n  - when: A few extra controls next to a button, without blocking the page.\n    use: popover\n  - when: A short text hint on hover.\n    use: tooltip\n  - when: Telling the user something happened.\n    use: toast\nrelated: [alert-dialog, sheet, popover, button]\nrequiredParts: [Dialog, DialogTrigger, DialogContent, DialogFooter, DialogClose]\nantiPatterns:\n  - avoid: \"<DialogHeader><DialogTitle>...</DialogTitle></DialogHeader> (shadcn style)\"\n    instead: '<DialogContent title=\"...\" description=\"...\"> (BlankUI renders the header)'\n  - avoid: \"A Dialog with no visible title\"\n    instead: '<DialogContent title=\"Search\" hideTitle> keeps it for screen readers'\n  - avoid: \"Using Dialog to confirm a delete\"\n    instead: \"<AlertDialog>\"\n  - avoid: \"<DialogClose><Button>Cancel</Button></DialogClose> (a button inside a button)\"\n    instead: '<DialogClose asChild><Button variant=\"outline\">Cancel</Button></DialogClose>'\n---\n\n# Dialog\n\nThe title is a prop on `DialogContent`, so a dialog can never be missing its accessible name. BlankUI does not export `DialogHeader`, `DialogTitle` or `DialogDescription`.\n\n## Import\n\n```tsx\nimport {\n  Dialog,\n  DialogClose,\n  DialogContent,\n  DialogFooter,\n  DialogTrigger,\n} from \"@/components/ui/dialog\"\n```\n\n## Example\n\n```tsx\n<Dialog>\n  <DialogTrigger asChild>\n    <Button>Edit profile</Button>\n  </DialogTrigger>\n  <DialogContent title=\"Edit profile\" description=\"Changes are saved when you click Save.\">\n    <Stack gap={4}>\n      <Field label=\"Name\">\n        <Input defaultValue=\"Ada\" />\n      </Field>\n    </Stack>\n    <DialogFooter>\n      <DialogClose asChild>\n        <Button variant=\"outline\">Cancel</Button>\n      </DialogClose>\n      <Button type=\"submit\">Save</Button>\n    </DialogFooter>\n  </DialogContent>\n</Dialog>\n```\n\n## Controlled\n\n```tsx\nconst [open, setOpen] = useState(false)\n\n<Dialog open={open} onOpenChange={setOpen}>\n  <DialogContent title=\"Invite people\">...</DialogContent>\n</Dialog>\n```\n\n## DialogContent props\n\n- `title` (required), `description`\n- `hideTitle`: keeps the title for screen readers only\n- `size`: `sm`, `md` (default), `lg`\n- `showCloseButton`: defaults to `true`\n"
    }
  ],
  "docs": "Read components/ui/dialog.md before using Dialog. Docs: https://blank.vageshwar.dev/docs/dialog",
  "meta": {
    "category": "overlay",
    "requiredParts": [
      "Dialog",
      "DialogTrigger",
      "DialogContent",
      "DialogFooter",
      "DialogClose"
    ],
    "related": [
      "alert-dialog",
      "sheet",
      "popover",
      "button"
    ]
  }
}
