{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "inline-edit-page-title",
  "title": "Inline Edit Page Title",
  "description": "A page heading that edits in place, refuses an empty name and keeps the browser tab title in sync with what was saved.",
  "registryDependencies": [
    "@tealmac/inline-edit"
  ],
  "files": [
    {
      "path": "registry/patterns/inline-edit-page-title/inline-edit-page-title.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { InlineEdit } from \"@/components/ui/inline-edit\"\n\nexport interface InlineEditPageTitleProps {\n  title: string\n  onRename: (next: string) => void | Promise<void>\n  /** Suffix for the tab title, for example \" - Acme\". */\n  tabSuffix?: string\n}\n\n/**\n * The page's <h1> is the editable control. It cannot be saved empty, and once\n * saved the browser tab title follows (so history, bookmarks and the window\n * switcher show the new name). The heading level stays an h1 for the outline;\n * the edit button inside it has a clear name.\n */\nexport function InlineEditPageTitle({\n  title,\n  onRename,\n  tabSuffix = \"\",\n}: InlineEditPageTitleProps) {\n  React.useEffect(() => {\n    const previous = document.title\n    document.title = `${title}${tabSuffix}`\n    return () => {\n      document.title = previous\n    }\n  }, [title, tabSuffix])\n\n  return (\n    <h1 className=\"text-2xl font-semibold tracking-tight\">\n      <InlineEdit\n        label=\"Page title\"\n        value={title}\n        validate={(v) => (v ? null : \"A title is required\")}\n        onSave={onRename}\n        className=\"text-2xl font-semibold\"\n      />\n    </h1>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "type": "registry:block"
}