{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "split-view",
  "type": "registry:component",
  "title": "Split view",
  "description": "Keep a collection and its selected record together, with a focused mobile detail view.",
  "categories": [
    "layout"
  ],
  "dependencies": [
    "@tabler/icons-react"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "src/registry/overtrue/split-view.tsx",
      "type": "registry:component",
      "target": "components/overtrue/split-view.tsx",
      "content": "\"use client\";\n\nimport { useEffect, useRef, type ReactNode } from \"react\";\nimport { IconArrowLeft } from \"@tabler/icons-react\";\nimport { cn } from \"@/lib/utils\";\n\n/** Keep the collection and its selected record together; mobile opens one pane at a time. */\nexport function SplitView({\n  list,\n  children,\n  selected,\n  onBack,\n  listLabel = \"Items\",\n  detailLabel = \"Details\",\n  className,\n}: {\n  list: ReactNode;\n  children: ReactNode;\n  selected: boolean;\n  onBack: () => void;\n  listLabel?: string;\n  detailLabel?: string;\n  className?: string;\n}) {\n  const listRef = useRef<HTMLDivElement>(null);\n  const detailRef = useRef<HTMLDivElement>(null);\n  const trigger = useRef<HTMLElement | null>(null);\n  const previous = useRef(selected);\n  useEffect(() => {\n    if (\n      selected &&\n      !previous.current &&\n      listRef.current &&\n      getComputedStyle(listRef.current).display === \"none\"\n    )\n      detailRef.current?.focus();\n    if (!selected && previous.current) {\n      if (trigger.current?.isConnected) trigger.current.focus();\n      else listRef.current?.focus();\n    }\n    previous.current = selected;\n  }, [selected]);\n  return (\n    <section\n      data-slot=\"split-view\"\n      className={cn(\n        \"@container min-w-0 overflow-hidden rounded-xl border border-border bg-card text-card-foreground\",\n        className,\n      )}\n    >\n      <div className=\"grid min-w-0 @2xl:grid-cols-[minmax(230px,1fr)_minmax(0,2fr)]\">\n        <div\n          ref={listRef}\n          tabIndex={-1}\n          data-slot=\"split-view-list\"\n          aria-label={listLabel}\n          onClickCapture={(event) => {\n            const target = (event.target as HTMLElement).closest<HTMLElement>(\n              \"button,a\",\n            );\n            if (target) trigger.current = target;\n          }}\n          className={cn(\n            \"min-w-0 @2xl:border-e @2xl:border-border\",\n            selected && \"hidden @2xl:block\",\n          )}\n        >\n          {list}\n        </div>\n        <div\n          ref={detailRef}\n          data-slot=\"split-view-detail\"\n          tabIndex={-1}\n          aria-label={detailLabel}\n          className={cn(\n            \"min-w-0 outline-none\",\n            !selected && \"hidden @2xl:block\",\n          )}\n        >\n          {selected && (\n            <button\n              type=\"button\"\n              onClick={onBack}\n              className=\"flex min-h-11 w-full items-center gap-2 border-b border-border px-4 text-xs font-medium hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring @2xl:hidden\"\n            >\n              <IconArrowLeft size={15} aria-hidden=\"true\" />\n              Back to {listLabel.toLowerCase()}\n            </button>\n          )}\n          {children}\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ],
  "docs": "Documentation: https://ui.overtrue.xyz/components/split-view. Requires an initialized shadcn/ui project with Tailwind CSS v4."
}
