{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "document-card",
  "type": "registry:component",
  "title": "Document card",
  "description": "Document preview with properties, editable lists and tasks. Based on the MCP Apps for Claude kit.",
  "registryDependencies": [
    "https://mcpblocks.dev/r/host-tokens.json"
  ],
  "files": [
    {
      "path": "registry/mcpblocks/components/document-card.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport type DocumentProperty = {\n  label: string\n  value: string\n  /** Render the value as a tag. */\n  tag?: boolean\n}\n\nexport type DocumentSection =\n  | { kind: \"list\"; heading: string; items: string[] }\n  | { kind: \"tasks\"; heading: string; items: { text: string; done?: boolean }[]; placeholder?: string }\n\nexport type DocumentCardProps = {\n  title: string\n  /** Optional leading emoji or short glyph. */\n  icon?: string\n  properties?: DocumentProperty[]\n  sections: DocumentSection[]\n  /** Make list items and tasks editable in place. */\n  editable?: boolean\n  /** Called with the updated sections whenever the user edits. */\n  onChange?: (sections: DocumentSection[]) => void\n  className?: string\n}\n\n/**\n * A document or page preview with properties, lists and tasks, editable inline.\n * Matches the \"Inline editing\" pattern in the MCP Apps for Claude kit.\n */\nexport function DocumentCard({\n  title,\n  icon,\n  properties,\n  sections: initial,\n  editable = true,\n  onChange,\n  className,\n}: DocumentCardProps) {\n  const [sections, setSections] = React.useState(initial)\n\n  function update(next: DocumentSection[]) {\n    setSections(next)\n    onChange?.(next)\n  }\n\n  return (\n    <div\n      data-slot=\"document-card\"\n      className={cn(\"flex w-full flex-col gap-6 px-4 pt-4 pb-6 text-host-fg font-[family-name:var(--font-sans)]\", className)}\n    >\n      <h3 className=\"flex items-center gap-2 text-xl leading-[1.4] font-semibold\">\n        {icon ? <span aria-hidden=\"true\">{icon}</span> : null}\n        <span className=\"min-w-0 truncate\">{title}</span>\n      </h3>\n\n      {properties?.length ? (\n        <dl className=\"flex flex-col gap-2 rounded-host-xl bg-host-bg-tertiary px-4 py-2\">\n          {properties.map((p) => (\n            <div key={p.label} className=\"flex items-center gap-3 text-sm leading-[1.4]\">\n              <dt className=\"w-[72px] shrink-0 text-host-fg-tertiary\">{p.label}</dt>\n              <dd className=\"min-w-0 py-1 text-host-fg-secondary\">\n                {p.tag ? (\n                  <span className=\"rounded-host-sm border-[length:var(--border-width-regular,0.5px)] border-host-info-border/40 bg-host-info-bg px-2 py-1 text-host-fg\">{p.value}</span>\n                ) : (\n                  p.value\n                )}\n              </dd>\n            </div>\n          ))}\n        </dl>\n      ) : null}\n\n      {sections.map((section, si) => (\n        <section key={section.heading + si} className={cn(\"flex flex-col\", section.kind === \"list\" ? \"gap-2\" : \"gap-3\")}>\n          <h4 className=\"text-sm leading-[1.4] font-semibold\">{section.heading}</h4>\n\n          {section.kind === \"list\" ? (\n            <ul className=\"flex flex-col gap-0.5 px-2\">\n              {section.items.map((item, ii) => (\n                <li key={ii}>\n                  <div\n                    contentEditable={editable}\n                    suppressContentEditableWarning\n                    role={editable ? \"textbox\" : undefined}\n                    aria-label={editable ? `${section.heading} item ${ii + 1}` : undefined}\n                    onBlur={(e) => {\n                      const text = e.currentTarget.textContent ?? \"\"\n                      if (text === item) return\n                      const next = sections.map((s, i) =>\n                        i === si && s.kind === \"list\" ? { ...s, items: s.items.map((it, j) => (j === ii ? text : it)) } : s\n                      )\n                      update(next)\n                    }}\n                    className={cn(\n                      \"rounded-host-sm border-[length:var(--border-width-regular,0.5px)] border-transparent px-1.5 py-1 text-sm leading-[1.4] text-host-fg-secondary outline-none\",\n                      editable && \"focus:border-host-border-tertiary hover:bg-host-bg-tertiary\"\n                    )}\n                  >\n                    {item}\n                  </div>\n                </li>\n              ))}\n            </ul>\n          ) : (\n            <ul className=\"flex flex-col gap-2\">\n              {section.items.length === 0 && section.placeholder ? (\n                <li className=\"flex items-center gap-3 text-sm leading-[1.4] text-host-fg-tertiary opacity-75\">\n                  <span aria-hidden=\"true\" className=\"size-4 shrink-0 rounded-host-xs border-[length:var(--border-width-regular,0.5px)] border-host-border-secondary bg-host-bg\" />\n                  {section.placeholder}\n                </li>\n              ) : null}\n              {section.items.map((task, ti) => (\n                <li key={ti}>\n                  <label className=\"flex cursor-pointer items-center gap-3 text-sm leading-[1.4] text-host-fg-secondary\">\n                    <input\n                      type=\"checkbox\"\n                      checked={!!task.done}\n                      disabled={!editable}\n                      onChange={(e) => {\n                        const next = sections.map((s, i) =>\n                          i === si && s.kind === \"tasks\"\n                            ? { ...s, items: s.items.map((it, j) => (j === ti ? { ...it, done: e.target.checked } : it)) }\n                            : s\n                        )\n                        update(next)\n                      }}\n                      className=\"size-4 shrink-0 rounded-host-xs accent-[var(--color-text-primary)]\"\n                    />\n                    <span className={cn(task.done && \"text-host-fg-tertiary line-through\")}>{task.text}</span>\n                  </label>\n                </li>\n              ))}\n            </ul>\n          )}\n        </section>\n      ))}\n    </div>\n  )\n}\n",
      "type": "registry:component"
    }
  ]
}