{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "collapsible",
  "type": "registry:ui",
  "title": "Collapsible",
  "description": "One button that shows or hides a region below it, with aria-expanded and aria-controls.",
  "dependencies": [
    "lucide-react@^1.49.0"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/theme.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/ui/collapsible.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/ui/collapsible.tsx",
      "content": "import { useId, useState, type ReactNode } from 'react';\nimport { ChevronDown } from 'lucide-react';\nimport { cn } from '../lib/utils';\n\nexport interface CollapsibleProps {\n  /** The always-visible line that opens and closes the rest. */\n  title: ReactNode;\n  children: ReactNode;\n  open?: boolean;\n  defaultOpen?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  disabled?: boolean;\n  className?: string;\n}\n\n/** One show-more region: a button that reveals extra content below it. For a list of them, use Accordion. */\nexport function Collapsible({ title, children, open, defaultOpen, onOpenChange, disabled, className }: CollapsibleProps) {\n  const id = useId();\n  const [own, setOwn] = useState(!!defaultOpen);\n  const shown = open ?? own;\n  return (\n    <div data-state={shown ? 'open' : 'closed'} className={cn('flex flex-col gap-2', className)}>\n      <button\n        type=\"button\"\n        aria-expanded={shown}\n        aria-controls={`${id}-c`}\n        disabled={disabled}\n        onClick={() => { setOwn(!shown); onOpenChange?.(!shown); }}\n        className={cn(\n          'group inline-flex min-h-11 items-center gap-2 self-start rounded-kh text-kh-body font-medium text-kh-ink',\n          'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--kh-focus) disabled:cursor-not-allowed disabled:text-kh-muted',\n        )}\n      >\n        <ChevronDown aria-hidden className={cn('size-4 text-kh-muted transition-transform duration-(--kh-dur)', shown && 'rotate-180')} />\n        {title}\n      </button>\n      <div id={`${id}-c`} hidden={!shown} className=\"text-kh-body text-kh-muted\">{children}</div>\n    </div>\n  );\n}\n"
    }
  ]
}
