{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "shell-page-heading",
  "title": "Page heading",
  "description": "The heading a page focuses on arrival, with an optional eyebrow, description and action, so hash navigation reads like a page load to assistive technology.",
  "files": [
    {
      "path": "shell/page-heading.tsx",
      "content": "import {\n  useEffect,\n  useLayoutEffect,\n  useRef,\n  useState,\n  type ReactNode,\n} from \"react\";\n\n/**\n * The heading a page focuses on arrival, so a hash-routed navigation reads\n * out like a page load to assistive technology. An eyebrow names the\n * section above the title; the action sits beside it, usually a button.\n */\nexport function PageHeading({\n  eyebrow,\n  title,\n  description,\n  action,\n}: {\n  eyebrow?: string;\n  title: string;\n  description?: string;\n  action?: ReactNode;\n}) {\n  const heading = useRef<HTMLHeadingElement>(null);\n  useEffect(() => {\n    if (location.hash) heading.current?.focus({ preventScroll: true });\n  }, [title]);\n  return (\n    <div className=\"page-heading\">\n      <div>\n        {eyebrow && <p className=\"eyebrow\">{eyebrow}</p>}\n        <h1 ref={heading} tabIndex={-1}>\n          {title}\n        </h1>\n        {description && <p className=\"lead\">{description}</p>}\n      </div>\n      {action}\n    </div>\n  );\n}\n\n/**\n * Whether a state shown in place of a page (loading, a failed read) is the\n * heading one of the screen, because no page heading stands on it. Decided\n * once, as the state arrives, from the document: a state shown beside a\n * page's own heading stays a lower heading.\n */\nexport function useStandsAsPageTitle(): boolean {\n  const [stands, setStands] = useState(false);\n  useLayoutEffect(() => {\n    setStands(document.querySelector(\"h1\") === null);\n  }, []);\n  return stands;\n}\n",
      "type": "registry:block",
      "target": "@components/shell/page-heading.tsx"
    }
  ],
  "type": "registry:block"
}