{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tab-bar",
  "type": "registry:ui",
  "title": "Tab Bar",
  "description": "The tab-bar primitive.",
  "dependencies": [],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/theme.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/ui/tab-bar.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/ui/tab-bar.tsx",
      "content": "import type { ComponentType, ReactNode } from 'react';\nimport { cn } from '../lib/utils';\n\nexport interface TabBarItem {\n  href: string;\n  label: string;\n  icon: ComponentType<{ 'aria-hidden'?: boolean; className?: string }>;\n  current?: boolean;\n}\n\n// Class names, not an inline style: server-rendered HTML carries no style attributes (CSP style-src self).\nconst COLS = ['', '', 'grid-cols-2', 'grid-cols-3', 'grid-cols-4', 'grid-cols-5'];\n\nconst plainLink = ({ href, className, children, current }: { href: string; className: string; children: ReactNode; current?: boolean }) => (\n  <a href={href} aria-current={current ? 'page' : undefined} className={className}>{children}</a>\n);\n\n/**\n * An app's main places as a bar fixed to the foot of a phone screen (three to five), beside a Sidebar that takes over from @4xl\n * of the host's container. Icon over a word; the current place in the accent ink with aria-current. The host leaves room at the\n * foot of its main (pb-28 covers the bar and the safe area). link renders each tab, for a router's Link.\n */\nexport function TabBar({ items, label = 'Main', link = plainLink, className }: {\n  items: TabBarItem[];\n  label?: string;\n  link?: (props: { href: string; className: string; children: ReactNode; current?: boolean }) => ReactNode;\n  className?: string;\n}) {\n  return (\n    <nav\n      aria-label={label}\n      className={cn('fixed inset-x-0 bottom-0 z-30 grid border-t border-kh-line bg-kh-surface/95 pb-[env(safe-area-inset-bottom)] backdrop-blur @4xl:hidden', COLS[Math.min(Math.max(items.length, 2), 5)], className)}\n    >\n      {items.map(({ href, label: name, icon: Icon, current }) => (\n        <span key={href} className=\"contents\">\n          {link({\n            href,\n            current,\n            className: cn(\n              'flex min-h-14 min-w-0 flex-col items-center justify-center gap-0.5 px-1 text-kh-caption transition-colors duration-(--kh-dur) active:bg-kh-surface-2',\n              'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-(--kh-focus)',\n              current ? 'font-medium text-kh-accent-ink' : 'text-kh-muted',\n            ),\n            children: <><Icon aria-hidden className=\"size-5\" /><span className=\"max-w-full truncate\">{name}</span></>,\n          })}\n        </span>\n      ))}\n    </nav>\n  );\n}\n"
    }
  ]
}
