{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "confirm-action",
  "type": "registry:component",
  "title": "Confirm action",
  "description": "Confirmation for a change Claude prepared: subject row with one confirm button and a checklist of what the change includes. Based on the MCP Apps for Claude kit.",
  "registryDependencies": [
    "https://mcpblocks.dev/r/status-update.json",
    "https://mcpblocks.dev/r/host-button.json",
    "https://mcpblocks.dev/r/icons.json"
  ],
  "files": [
    {
      "path": "registry/mcpblocks/components/confirm-action.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { StatusUpdate } from \"@/registry/mcpblocks/components/status-update\"\nimport { HostButton } from \"@/registry/mcpblocks/ui/host-button\"\nimport { CheckIcon } from \"@/registry/mcpblocks/ui/icons\"\n\nexport type ConfirmActionStatus = \"pending\" | \"working\" | \"done\" | \"error\"\n\nexport type ConfirmActionProps = {\n  /** What will happen, e.g. \"Set lead assignment permission\". */\n  title: React.ReactNode\n  /** The person or record the action applies to. */\n  subject: {\n    name: string\n    detail?: string\n    initials?: string\n    avatarColor?: string\n  }\n  /** Button label, e.g. \"Confirm assignment\". */\n  confirmLabel?: string\n  /** Called on confirm. Return a promise to show the working state. */\n  onConfirm?: () => unknown\n  /** Optional list of what the change includes. */\n  details?: { heading: string; items: string[] }\n  doneTitle?: React.ReactNode\n  doneDescription?: React.ReactNode\n  onUndo?: () => void\n  errorTitle?: React.ReactNode\n  /** Control the status from outside (e.g. after a tool result arrives). */\n  status?: ConfirmActionStatus\n  className?: string\n}\n\n/**\n * Confirmation for a change Claude has prepared: what happens, who it applies\n * to, one confirm button, and what the change includes.\n * Matches the \"Confirmation actions\" pattern in the MCP Apps for Claude kit.\n * Edits stay in the conversation; the widget only confirms.\n */\nexport function ConfirmAction({\n  title,\n  subject,\n  confirmLabel = \"Confirm\",\n  onConfirm,\n  details,\n  doneTitle = \"Done\",\n  doneDescription,\n  onUndo,\n  errorTitle = \"That didn't work\",\n  status: controlled,\n  className,\n}: ConfirmActionProps) {\n  const [internal, setInternal] = React.useState<ConfirmActionStatus>(\"pending\")\n  const status = controlled ?? internal\n\n  async function confirm() {\n    try {\n      setInternal(\"working\")\n      await onConfirm?.()\n      setInternal(\"done\")\n    } catch {\n      setInternal(\"error\")\n    }\n  }\n\n  if (status === \"done\") {\n    return (\n      <StatusUpdate\n        className={className}\n        tone=\"success\"\n        title={doneTitle}\n        description={doneDescription}\n        action={onUndo ? { label: \"Undo\", onClick: () => { onUndo(); setInternal(\"pending\") } } : undefined}\n      />\n    )\n  }\n  if (status === \"error\") {\n    return (\n      <StatusUpdate\n        className={className}\n        tone=\"danger\"\n        title={errorTitle}\n        description=\"Nothing was changed.\"\n        action={{ label: \"Try again\", onClick: confirm }}\n      />\n    )\n  }\n\n  const initials =\n    subject.initials ??\n    subject.name\n      .split(/\\s+/)\n      .map((p) => p[0])\n      .slice(0, 2)\n      .join(\"\")\n      .toUpperCase()\n\n  return (\n    <div\n      data-slot=\"confirm-action\"\n      className={cn(\"flex w-full flex-col gap-6 p-6 text-host-fg font-[family-name:var(--font-sans)]\", className)}\n    >\n      <h3 className=\"text-xl leading-[25px] font-semibold\">{title}</h3>\n\n      <div className=\"flex flex-wrap items-center justify-between gap-3 rounded-host-xl border-[length:var(--border-width-regular,0.5px)] border-host-border-secondary p-4\">\n        <div className=\"flex min-w-0 items-center gap-3\">\n          <span\n            aria-hidden=\"true\"\n            className=\"flex size-10 shrink-0 items-center justify-center rounded-full text-sm font-semibold text-white\"\n            style={{ backgroundColor: subject.avatarColor ?? \"var(--color-text-info)\" }}\n          >\n            {initials}\n          </span>\n          <span className=\"flex min-w-0 flex-col\">\n            <span className=\"truncate text-sm leading-[19.6px] font-semibold\">{subject.name}</span>\n            {subject.detail ? (\n              <span className=\"truncate text-sm leading-[19.6px] text-host-fg-tertiary opacity-75\">{subject.detail}</span>\n            ) : null}\n          </span>\n        </div>\n        <HostButton onClick={confirm} disabled={status === \"working\"}>\n          {status === \"working\" ? \"Working…\" : confirmLabel}\n        </HostButton>\n      </div>\n\n      {details ? (\n        <div className=\"flex flex-col gap-4\">\n          <h4 className=\"text-sm leading-[19.6px] font-semibold\">{details.heading}</h4>\n          <ul className=\"flex flex-col gap-3\">\n            {details.items.map((item) => (\n              <li key={item} className=\"flex items-start gap-2 text-sm leading-[19.6px] text-host-fg-tertiary\">\n                <CheckIcon className=\"size-5 shrink-0\" />\n                {item}\n              </li>\n            ))}\n          </ul>\n        </div>\n      ) : null}\n    </div>\n  )\n}\n",
      "type": "registry:component"
    }
  ]
}