{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "compose-fab-collapse",
  "title": "Compose FAB Collapse",
  "description": "An extended Compose button that shrinks to an icon while the list scrolls down and grows back on the way up, always keeping its name for screen readers. Use this when a phone list screen has one dominant create action that should stay reachable without covering the content.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "@tealmac/fab"
  ],
  "files": [
    {
      "path": "registry/patterns/compose-fab-collapse/compose-fab-collapse.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { PencilIcon } from \"lucide-react\"\n\nimport { Fab, useCollapseOnScroll } from \"@/components/ui/fab\"\n\nexport interface ComposeFabCollapseProps {\n  label?: string\n  onCompose: () => void\n  children: React.ReactNode\n  className?: string\n}\n\nexport function ComposeFabCollapse({\n  label = \"Compose\",\n  onCompose,\n  children,\n  className,\n}: ComposeFabCollapseProps) {\n  const scrollRef = React.useRef<HTMLDivElement>(null)\n  const collapsed = useCollapseOnScroll(scrollRef)\n  return (\n    <div\n      className={\n        className ??\n        \"relative h-80 w-full max-w-sm overflow-hidden rounded-xl border\"\n      }\n    >\n      <div\n        ref={scrollRef}\n        role=\"region\"\n        aria-label=\"List\"\n        // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- a scrolling region must be focusable for keyboard users\n        tabIndex={0}\n        className=\"focus-visible:ring-ring h-full overflow-y-auto pb-24 outline-none focus-visible:ring-2 focus-visible:ring-inset\"\n      >\n        {children}\n      </div>\n      <Fab\n        extended\n        collapsed={collapsed}\n        icon={<PencilIcon />}\n        label={label}\n        onClick={onCompose}\n        className=\"absolute end-4 bottom-4\"\n      />\n    </div>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "type": "registry:block"
}