{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "navbar",
  "title": "Navbar",
  "description": "A floating navbar that shrinks and collapses to a pill shape on scroll.",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "components/library/navbar.tsx",
      "content": "\"use client\";\n\nimport { motion } from \"motion/react\";\nimport Link from \"next/link\";\nimport { useEffect, useState } from \"react\";\n\n/** A single navigation link entry. */\nexport interface NavItem {\n  label: string;\n  href: string;\n  /** React node rendered before the label (icon, SVG, Image, etc.). */\n  icon?: React.ReactNode;\n}\n\nexport interface NavbarProps {\n  /**\n   * Brand / logo item on the left.\n   * @default { label: \"Knot-ui\", href: \"/\" }\n   */\n  logo?: NavItem;\n  /**\n   * Label for the login / CTA link on the right.\n   * @default \"Login\"\n   */\n  loginLabel?: string;\n  /**\n   * href for the login / CTA link.\n   * @default \"/login\"\n   */\n  loginHref?: string;\n  /**\n   * Width when at the top of the page (fully expanded).\n   * @default \"min(56rem, calc(100vw - 2rem))\"\n   */\n  expandedWidth?: string;\n  /**\n   * Width after scrolling past `shrinkAfter`. Corners also animate to a full\n   * pill shape at this point.\n   * @default \"min(18rem, calc(100vw - 2rem))\"\n   */\n  collapsedWidth?: string;\n  /**\n   * Scroll distance in pixels before the navbar fully collapses.\n   * @default 200\n   */\n  shrinkAfter?: number;\n  className?: string;\n}\n\nexport const Navbar = ({\n  logo = { label: \"Knot-ui\", href: \"/\", icon: <img src=\"/home.svg\" width={25} height={25} alt=\"\" /> },\n  loginLabel = \"Login\",\n  loginHref = \"/login\",\n  expandedWidth = \"min(56rem, calc(100vw - 2rem))\",\n  collapsedWidth = \"min(18rem, calc(100vw - 2rem))\",\n  shrinkAfter = 200,\n  className = \"\",\n}: NavbarProps) => {\n  const [isCollapsed, setIsCollapsed] = useState(false);\n\n  useEffect(() => {\n    const onScroll = () => setIsCollapsed(window.scrollY >= shrinkAfter);\n    window.addEventListener(\"scroll\", onScroll, { passive: true });\n    return () => window.removeEventListener(\"scroll\", onScroll);\n  }, [shrinkAfter]);\n\n  return (\n    <div className={`fixed top-0 left-1/2 -translate-x-1/2 mt-5 z-50 ${className}`}>\n      <motion.nav\n        animate={{\n          width: isCollapsed ? collapsedWidth : expandedWidth,\n        }}\n        transition={{ type: \"spring\", stiffness: 300, damping: 30 }}\n        aria-label=\"Site navigation\"\n        className=\"bg-gray-100 px-5 rounded-xl py-1 flex justify-between items-center shadow-sm overflow-hidden\"\n      >\n        {/* Logo / brand */}\n        <Link\n          href={logo.href}\n          className=\"inline-flex items-center gap-2 px-3 py-2 whitespace-nowrap\"\n        >\n          {logo.icon && <span className=\"shrink-0\">{logo.icon}</span>}\n          <span className=\"text-base font-semibold text-neutral-900 tracking-tight\">\n            {logo.label}\n          </span>\n        </Link>\n\n        {/* Login / CTA */}\n        <Link\n          href={loginHref}\n          className=\"inline-flex items-center px-3 py-2 text-sm font-medium text-neutral-500 hover:text-neutral-950 transition-colors whitespace-nowrap\"\n        >\n          {loginLabel}\n        </Link>\n      </motion.nav>\n    </div>\n  );\n};\n\nNavbar.displayName = \"Navbar\";",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}