{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "navbar-morph-underline",
  "type": "registry:component",
  "title": "Navbar Morph Underline",
  "description": "A documentation header whose underline crawls between links like an inchworm: the leading edge moves first and the trailing edge catches up. On narrow screens the links become a scrollable tab strip that keeps the same underline.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "navigation",
    "navbar",
    "underline",
    "tabs",
    "docs",
    "light",
    "header"
  ],
  "docs": "https://hyperblur.dev/effects/navbar-morph-underline",
  "files": [
    {
      "path": "registry/hyperblur/navbar-morph-underline.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/navbar-morph-underline.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface NavbarMorphUnderlineLink {\n  label: string;\n  href: string;\n  count?: number;\n}\n\nexport interface NavbarMorphUnderlineProps extends Omit<React.HTMLAttributes<HTMLElement>, \"children\"> {\n  brand?: string;\n  links?: NavbarMorphUnderlineLink[];\n  active?: number;\n  defaultActive?: number;\n  onActiveChange?: (index: number) => void;\n  cta?: { label: string; href: string } | null;\n  appearance?: \"light\" | \"dark\";\n  accent?: string;\n  showBackdrop?: boolean;\n}\n\nconst css = `\n.hb-xi2 {\n  --hb-xi2-accent: #e5484d;\n  --hb-xi2-bg: #f7f5ef;\n  --hb-xi2-fg: #1b1a17;\n  --hb-xi2-mute: #77736a;\n  --hb-xi2-line: rgba(27,26,23,.1);\n  --hb-xi2-chip: rgba(27,26,23,.06);\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  container-type: inline-size;\n  background: var(--hb-xi2-bg);\n  color: var(--hb-xi2-fg);\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-xi2[data-appearance=\"dark\"] {\n  --hb-xi2-bg: #0c0c0d;\n  --hb-xi2-fg: #ededed;\n  --hb-xi2-mute: #8f8f8f;\n  --hb-xi2-line: rgba(255,255,255,.09);\n  --hb-xi2-chip: rgba(255,255,255,.07);\n}\n.hb-xi2 *, .hb-xi2 *::before, .hb-xi2 *::after { box-sizing: border-box; }\n.hb-xi2-bar { position: relative; z-index: 2; border-bottom: 1px solid var(--hb-xi2-line); background: color-mix(in srgb, var(--hb-xi2-bg) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }\n.hb-xi2-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px; max-width: 1120px; height: 64px; margin: 0 auto; padding: 0 24px; }\n.hb-xi2-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--hb-xi2-fg); font-size: 16px; font-weight: 700; letter-spacing: -.025em; text-decoration: none; border-radius: 6px; }\n.hb-xi2-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--hb-xi2-fg); color: var(--hb-xi2-bg); }\n.hb-xi2-mark svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }\n.hb-xi2-track { position: relative; display: flex; align-self: stretch; min-width: 0; margin: 0; padding: 0; list-style: none; }\n.hb-xi2-track li { display: flex; }\n.hb-xi2-link {\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  gap: 7px;\n  padding: 0 14px;\n  color: var(--hb-xi2-mute);\n  font-size: 14px;\n  font-weight: 500;\n  white-space: nowrap;\n  text-decoration: none;\n  transition: color .3s ease;\n}\n.hb-xi2-link:hover, .hb-xi2-link[data-target=\"true\"] { color: var(--hb-xi2-fg); }\n.hb-xi2-link[aria-current=\"page\"] { color: var(--hb-xi2-fg); font-weight: 600; }\n.hb-xi2-link:focus-visible { outline: none; }\n.hb-xi2-link:focus-visible .hb-xi2-lt { outline: 2px solid var(--hb-xi2-accent); outline-offset: 4px; border-radius: 4px; }\n.hb-xi2-count { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--hb-xi2-chip); color: var(--hb-xi2-mute); font-family: var(--font-mono, ui-monospace, monospace); font-size: 11px; font-weight: 500; text-align: center; transition: background-color .3s ease, color .3s ease; }\n.hb-xi2-link[aria-current=\"page\"] .hb-xi2-count { background: color-mix(in srgb, var(--hb-xi2-accent) 14%, transparent); color: var(--hb-xi2-accent); }\n.hb-xi2-worm {\n  position: absolute;\n  bottom: -1px;\n  left: 0;\n  right: 100%;\n  height: 2px;\n  border-radius: 2px;\n  background: var(--hb-xi2-fg);\n  pointer-events: none;\n  transition: left .5s cubic-bezier(.65,0,.2,1) var(--hb-xi2-dl, 0s), right .5s cubic-bezier(.65,0,.2,1) var(--hb-xi2-dr, 0s), background-color .3s ease, height .3s ease;\n}\n.hb-xi2-worm[data-home=\"true\"] { height: 3px; background: var(--hb-xi2-accent); }\n.hb-xi2-worm::after { content: \"\"; position: absolute; inset: -3px -2px; border-radius: 4px; background: inherit; opacity: .18; filter: blur(4px); }\n.hb-xi2-worm[data-ready=\"false\"] { opacity: 0; transition: none; }\n.hb-xi2-end { display: flex; align-items: center; gap: 8px; }\n.hb-xi2-kbd { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 12px; border: 1px solid var(--hb-xi2-line); border-radius: 10px; background: transparent; color: var(--hb-xi2-mute); font-size: 13px; cursor: pointer; font-family: inherit; transition: border-color .2s ease, color .2s ease; }\n.hb-xi2-kbd:hover { color: var(--hb-xi2-fg); border-color: color-mix(in srgb, var(--hb-xi2-fg) 25%, transparent); }\n.hb-xi2-kbd svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }\n.hb-xi2-kbd kbd { padding: 1px 5px; border-radius: 5px; background: var(--hb-xi2-chip); font-family: var(--font-mono, ui-monospace, monospace); font-size: 11px; }\n.hb-xi2-cta { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 10px; background: var(--hb-xi2-fg); color: var(--hb-xi2-bg); font-size: 13.5px; font-weight: 600; text-decoration: none; box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 4px 12px -6px rgba(0,0,0,.5); transition: transform .2s cubic-bezier(.2,.8,.2,1), opacity .2s ease; }\n.hb-xi2-cta:hover { transform: translateY(-1px); }\n.hb-xi2-cta:active { transform: scale(.97); }\n.hb-xi2 a:focus-visible:not(.hb-xi2-link), .hb-xi2 button:focus-visible { outline: 2px solid var(--hb-xi2-accent); outline-offset: 2px; }\n.hb-xi2-stage { position: relative; height: 640px; overflow: hidden; }\n.hb-xi2-doc { display: grid; grid-template-columns: 200px 1fr; gap: 56px; max-width: 1120px; margin: 0 auto; padding: 48px 24px 0; }\n.hb-xi2-toc { display: grid; gap: 12px; align-content: start; color: var(--hb-xi2-mute); font-size: 13px; }\n.hb-xi2-toc b { color: var(--hb-xi2-fg); font-weight: 600; }\n.hb-xi2-crumb { color: var(--hb-xi2-mute); font-size: 13px; }\n.hb-xi2-h { margin: 12px 0 14px; font-family: var(--font-grotesk, var(--font-sans, ui-sans-serif, system-ui, sans-serif)); font-size: clamp(30px, 5cqi, 46px); font-weight: 600; letter-spacing: -.035em; line-height: 1.05; }\n.hb-xi2-lead { max-width: 600px; margin: 0 0 28px; color: var(--hb-xi2-mute); font-size: 17px; line-height: 1.6; }\n.hb-xi2-ln { height: 11px; margin-bottom: 14px; border-radius: 6px; background: var(--hb-xi2-chip); }\n.hb-xi2-code { margin: 26px 0; padding: 18px 20px; border: 1px solid var(--hb-xi2-line); border-radius: 12px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 13px; line-height: 1.7; color: var(--hb-xi2-mute); }\n.hb-xi2-code b { color: var(--hb-xi2-accent); font-weight: 500; }\n@container (max-width: 760px) {\n  .hb-xi2-row { grid-template-columns: 1fr auto; grid-template-rows: 56px 44px; gap: 0 12px; height: auto; padding: 0 16px; }\n  .hb-xi2-track { grid-column: 1 / -1; grid-row: 2; margin: 0 -16px; padding: 0 6px; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 24px), transparent); }\n  .hb-xi2-track::-webkit-scrollbar { display: none; }\n  .hb-xi2-link { padding: 0 12px; font-size: 13.5px; }\n  .hb-xi2-kbd span, .hb-xi2-kbd kbd { display: none; }\n  .hb-xi2-kbd { width: 34px; padding: 0; justify-content: center; }\n  .hb-xi2-doc { grid-template-columns: 1fr; padding-top: 32px; }\n  .hb-xi2-toc { display: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-xi2 *, .hb-xi2 *::before, .hb-xi2 *::after { animation: none !important; transition: none !important; }\n}\n`;\n\nconst defaultLinks: NavbarMorphUnderlineLink[] = [\n  { label: \"Guides\", href: \"#\", count: 48 },\n  { label: \"API reference\", href: \"#\" },\n  { label: \"Changelog\", href: \"#\", count: 3 },\n  { label: \"Examples\", href: \"#\" },\n  { label: \"Community\", href: \"#\" },\n];\n\nexport function NavbarMorphUnderline({\n  brand = \"Fieldnote\",\n  links = defaultLinks,\n  active,\n  defaultActive = 0,\n  onActiveChange,\n  cta = { label: \"Get API key\", href: \"#\" },\n  appearance = \"light\",\n  accent = \"#e5484d\",\n  showBackdrop = true,\n  className = \"\",\n  style,\n  ...rest\n}: NavbarMorphUnderlineProps) {\n  const [inner, setInner] = React.useState(defaultActive);\n  const [hover, setHover] = React.useState<number | null>(null);\n  const current = active ?? inner;\n  const target = hover ?? current;\n  const trackRef = React.useRef<HTMLUListElement>(null);\n  const wormRef = React.useRef<HTMLLIElement>(null);\n  const lastRef = React.useRef<{ l: number; r: number } | null>(null);\n\n  const place = React.useCallback((index: number, instant: boolean) => {\n    const track = trackRef.current;\n    const worm = wormRef.current;\n    if (!track || !worm) return;\n    const el = track.querySelectorAll<HTMLElement>(\"[data-hb-xi2-link]\")[index];\n    if (!el) return;\n    const pad = 14;\n    const l = el.offsetLeft + pad;\n    const r = track.clientWidth - (el.offsetLeft + el.offsetWidth) + pad;\n    const prev = lastRef.current;\n    const right = prev ? l > prev.l : true;\n    worm.style.setProperty(\"--hb-xi2-dl\", instant ? \"0s\" : right ? \".09s\" : \"0s\");\n    worm.style.setProperty(\"--hb-xi2-dr\", instant ? \"0s\" : right ? \"0s\" : \".09s\");\n    if (instant) worm.style.transition = \"none\";\n    worm.style.left = `${l}px`;\n    worm.style.right = `${r}px`;\n    worm.dataset.ready = \"true\";\n    if (instant) {\n      void worm.offsetWidth;\n      worm.style.transition = \"\";\n    }\n    lastRef.current = { l, r };\n  }, []);\n\n  React.useLayoutEffect(() => {\n    place(target, lastRef.current === null);\n    if (wormRef.current) wormRef.current.dataset.home = target === current ? \"true\" : \"false\";\n  }, [target, current, place, links]);\n\n  React.useEffect(() => {\n    const track = trackRef.current;\n    if (!track || typeof ResizeObserver === \"undefined\") return;\n    const ro = new ResizeObserver(() => place(target, true));\n    ro.observe(track);\n    return () => ro.disconnect();\n  }, [place, target]);\n\n  const select = (i: number) => {\n    if (active === undefined) setInner(i);\n    onActiveChange?.(i);\n  };\n\n  const onKey = (e: React.KeyboardEvent<HTMLUListElement>) => {\n    if (e.key !== \"ArrowRight\" && e.key !== \"ArrowLeft\" && e.key !== \"Home\" && e.key !== \"End\") return;\n    const items = Array.from(e.currentTarget.querySelectorAll<HTMLElement>(\"[data-hb-xi2-link]\"));\n    const at = items.indexOf(document.activeElement as HTMLElement);\n    if (at < 0) return;\n    e.preventDefault();\n    const n = items.length;\n    const next = e.key === \"Home\" ? 0 : e.key === \"End\" ? n - 1 : (at + (e.key === \"ArrowRight\" ? 1 : -1) + n) % n;\n    items[next]?.focus();\n  };\n\n  return (\n    <header className={`hb-xi2 ${className}`} data-appearance={appearance} style={{ \"--hb-xi2-accent\": accent, ...style } as React.CSSProperties} {...rest}>\n      <style href=\"hb-navbar-morph-underline\" precedence=\"default\">\n        {css}\n      </style>\n      <div className=\"hb-xi2-bar\">\n        <nav className=\"hb-xi2-row\" aria-label=\"Main\">\n          <a href=\"#\" className=\"hb-xi2-brand\" aria-label={`${brand} home`}>\n            <span className=\"hb-xi2-mark\" aria-hidden=\"true\">\n              <svg viewBox=\"0 0 14 14\">\n                <path d=\"M3 2.5h8M3 7h5M3 11.5h7\" />\n              </svg>\n            </span>\n            {brand}\n          </a>\n          <ul className=\"hb-xi2-track\" ref={trackRef} onKeyDown={onKey} onPointerLeave={() => setHover(null)}>\n            {links.map((link, i) => (\n              <li key={link.label}>\n                <a\n                  href={link.href}\n                  data-hb-xi2-link=\"\"\n                  className=\"hb-xi2-link\"\n                  data-target={i === target ? \"true\" : \"false\"}\n                  aria-current={i === current ? \"page\" : undefined}\n                  onPointerEnter={(e) => {\n                    if (e.pointerType === \"mouse\") setHover(i);\n                  }}\n                  onFocus={() => setHover(i)}\n                  onBlur={() => setHover(null)}\n                  onClick={() => select(i)}\n                >\n                  <span className=\"hb-xi2-lt\">{link.label}</span>\n                  {link.count !== undefined && <span className=\"hb-xi2-count\">{link.count}</span>}\n                </a>\n              </li>\n            ))}\n            <li ref={wormRef} className=\"hb-xi2-worm\" data-ready=\"false\" data-home=\"true\" aria-hidden=\"true\" />\n          </ul>\n          <div className=\"hb-xi2-end\">\n            <button type=\"button\" className=\"hb-xi2-kbd\" aria-label=\"Search docs\">\n              <svg viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n                <circle cx=\"6\" cy=\"6\" r=\"4\" />\n                <path d=\"M9 9l3 3\" />\n              </svg>\n              <span>Search</span>\n              <kbd>/</kbd>\n            </button>\n            {cta && (\n              <a href={cta.href} className=\"hb-xi2-cta\">\n                {cta.label}\n              </a>\n            )}\n          </div>\n        </nav>\n      </div>\n      {showBackdrop && (\n        <div className=\"hb-xi2-stage\" aria-hidden=\"true\">\n          <div className=\"hb-xi2-doc\">\n            <div className=\"hb-xi2-toc\">\n              <b>Getting started</b>\n              <span>Install the SDK</span>\n              <span>Authenticate</span>\n              <span>Your first note</span>\n              <span>Webhooks</span>\n              <span>Rate limits</span>\n            </div>\n            <div>\n              <div className=\"hb-xi2-crumb\">Guides / Getting started</div>\n              <h2 className=\"hb-xi2-h\">Capture your first field note</h2>\n              <p className=\"hb-xi2-lead\">Create a workspace token, send a note with location and photos attached, and watch it sync to every device in under a second.</p>\n              <div className=\"hb-xi2-ln\" style={{ width: \"92%\" }} />\n              <div className=\"hb-xi2-ln\" style={{ width: \"84%\" }} />\n              <div className=\"hb-xi2-ln\" style={{ width: \"66%\" }} />\n              <div className=\"hb-xi2-code\">\n                <b>npm</b> install @fieldnote/sdk\n                <br />\n                const note = await fieldnote.notes.create({\"{\"} title: <b>&quot;Site walk, Pier 7&quot;</b> {\"}\"})\n              </div>\n              <div className=\"hb-xi2-ln\" style={{ width: \"88%\" }} />\n              <div className=\"hb-xi2-ln\" style={{ width: \"72%\" }} />\n            </div>\n          </div>\n        </div>\n      )}\n    </header>\n  );\n}\n"
    }
  ]
}