{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "navbar-tabs-stretch",
  "type": "registry:component",
  "title": "Navbar Tabs Stretch",
  "description": "A project header with a row of tabs whose underline stretches like elastic: the leading edge races ahead and the trailing edge catches up. A ghost pill follows the pointer, counts sit in badges and the row scrolls with faded edges on phones.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "navigation",
    "navbar",
    "tabs",
    "indicator",
    "dashboard",
    "app header",
    "keyboard"
  ],
  "docs": "https://hyperblur.dev/effects/navbar-tabs-stretch",
  "files": [
    {
      "path": "registry/hyperblur/navbar-tabs-stretch.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/navbar-tabs-stretch.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface NavbarTabsStretchTab {\n  label: string;\n  href: string;\n  count?: number;\n}\n\nexport interface NavbarTabsStretchProps extends Omit<React.HTMLAttributes<HTMLElement>, \"children\" | \"onChange\"> {\n  brand?: string;\n  tabs?: NavbarTabsStretchTab[];\n  value?: number;\n  defaultValue?: number;\n  onValueChange?: (index: number) => void;\n  user?: { name: string; initials?: string } | null;\n  onNew?: () => void;\n  newLabel?: string;\n  accent?: string;\n  showBackdrop?: boolean;\n}\n\nconst defaultTabs: NavbarTabsStretchTab[] = [\n  { label: \"Overview\", href: \"#overview\" },\n  { label: \"Deployments\", href: \"#deployments\", count: 12 },\n  { label: \"Analytics\", href: \"#analytics\" },\n  { label: \"Logs\", href: \"#logs\" },\n  { label: \"Storage\", href: \"#storage\" },\n  { label: \"Integrations\", href: \"#integrations\", count: 3 },\n  { label: \"Settings\", href: \"#settings\" },\n];\n\nconst ease = \"cubic-bezier(.22,1,.36,1)\";\n\nconst css = `\n.hb-xj3 {\n  --hb-xj3-accent: #2f7bff;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  container-type: inline-size;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-xj3 *, .hb-xj3 *::before, .hb-xj3 *::after { box-sizing: border-box; }\n.hb-xj3[data-backdrop=\"true\"] { min-height: 620px; overflow: hidden; }\n.hb-xj3-head {\n  position: relative;\n  z-index: 3;\n  border-bottom: 1px solid #1f1f1f;\n  background: linear-gradient(180deg, #0f0f0f, #0b0b0b);\n}\n.hb-xj3-row { display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 20px; }\n.hb-xj3-brand { display: inline-flex; align-items: center; gap: 10px; color: #ededed; font-weight: 650; font-size: 15px; letter-spacing: -.02em; text-decoration: none; }\n.hb-xj3-logo { width: 22px; height: 22px; flex: none; }\n.hb-xj3-slash { color: #333; font-size: 22px; font-weight: 300; }\n.hb-xj3-proj { display: inline-flex; align-items: center; gap: 8px; color: #d4d4d4; font-size: 14px; font-weight: 500; white-space: nowrap; }\n.hb-xj3-proj i {\n  display: grid;\n  place-items: center;\n  width: 20px;\n  height: 20px;\n  border-radius: 50%;\n  background: conic-gradient(from 120deg, #f97316, #ec4899, #8b5cf6, #f97316);\n  font-style: normal;\n}\n.hb-xj3-tag { height: 20px; padding: 0 7px; border: 1px solid #2a2a2a; border-radius: 6px; color: #8f8f8f; font-size: 11px; line-height: 18px; }\n.hb-xj3-grow { flex: 1; }\n.hb-xj3-new {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  height: 32px;\n  padding: 0 12px 0 10px;\n  border: 0;\n  border-radius: 8px;\n  background: #ededed;\n  color: #0a0a0a;\n  font: inherit;\n  font-size: 13px;\n  font-weight: 600;\n  cursor: pointer;\n  box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);\n  transition: background-color .2s ease, transform .2s ${ease};\n}\n.hb-xj3-new:hover { background: #fff; }\n.hb-xj3-new:active { transform: scale(.97); }\n.hb-xj3-new svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }\n.hb-xj3-av {\n  display: grid;\n  place-items: center;\n  width: 32px;\n  height: 32px;\n  border-radius: 50%;\n  background: linear-gradient(135deg, #0ea5e9, #6366f1);\n  color: #fff;\n  font-size: 12px;\n  font-weight: 600;\n  box-shadow: 0 0 0 2px #0b0b0b, 0 0 0 3px #2a2a2a;\n}\n.hb-xj3-tabwrap { position: relative; padding: 0 12px; }\n.hb-xj3-tabs {\n  position: relative;\n  display: flex;\n  gap: 2px;\n  margin: 0;\n  padding: 0 0 0;\n  list-style: none;\n  overflow-x: auto;\n  scrollbar-width: none;\n  overscroll-behavior-x: contain;\n}\n.hb-xj3-tabs::-webkit-scrollbar { display: none; }\n.hb-xj3-ghost {\n  position: absolute;\n  top: 6px;\n  left: 0;\n  height: 32px;\n  width: var(--hb-xj3-gw, 0px);\n  border-radius: 8px;\n  background: rgba(255,255,255,.06);\n  opacity: 0;\n  transform: translateX(var(--hb-xj3-gx, 0px));\n  transition: transform .35s ${ease}, width .35s ${ease}, opacity .2s ease;\n  pointer-events: none;\n}\n.hb-xj3-tabs[data-hover=\"true\"] .hb-xj3-ghost { opacity: 1; }\n.hb-xj3-edge {\n  position: absolute;\n  bottom: 0;\n  height: 2px;\n  border-radius: 2px 2px 0 0;\n  background: linear-gradient(90deg, #ededed, var(--hb-xj3-accent), #ededed);\n  background-size: 200% 100%;\n  left: var(--hb-xj3-l, 0px);\n  width: calc(var(--hb-xj3-r, 0px) - var(--hb-xj3-l, 0px));\n  pointer-events: none;\n}\n.hb-xj3-edge::after {\n  content: \"\";\n  position: absolute;\n  left: 10%;\n  right: 10%;\n  bottom: 0;\n  height: 14px;\n  background: radial-gradient(50% 100% at 50% 100%, color-mix(in srgb, var(--hb-xj3-accent) 45%, transparent), transparent);\n  pointer-events: none;\n}\n.hb-xj3-tab {\n  position: relative;\n  z-index: 1;\n  display: inline-flex;\n  align-items: center;\n  gap: 7px;\n  height: 44px;\n  padding: 0 12px;\n  border: 0;\n  background: none;\n  color: #8f8f8f;\n  font: inherit;\n  font-size: 14px;\n  white-space: nowrap;\n  text-decoration: none;\n  cursor: pointer;\n  transition: color .2s ease;\n}\n.hb-xj3-tab:hover, .hb-xj3-tab[aria-selected=\"true\"] { color: #ededed; }\n.hb-xj3-tab:focus-visible { outline: none; }\n.hb-xj3-tab:focus-visible::before { content: \"\"; position: absolute; inset: 7px 2px; border-radius: 8px; box-shadow: 0 0 0 2px var(--hb-xj3-accent); }\n.hb-xj3-count {\n  display: inline-grid;\n  place-items: center;\n  min-width: 20px;\n  height: 18px;\n  padding: 0 6px;\n  border-radius: 999px;\n  background: #1f1f1f;\n  color: #a1a1a1;\n  font-size: 11px;\n  font-weight: 600;\n  font-variant-numeric: tabular-nums;\n  transition: background-color .2s ease, color .2s ease;\n}\n.hb-xj3-tab[aria-selected=\"true\"] .hb-xj3-count { background: color-mix(in srgb, var(--hb-xj3-accent) 22%, transparent); color: color-mix(in srgb, var(--hb-xj3-accent) 60%, #fff); }\n.hb-xj3 a:focus-visible, .hb-xj3 button:not(.hb-xj3-tab):focus-visible { outline: 2px solid var(--hb-xj3-accent); outline-offset: 2px; }\n@container (max-width: 640px) {\n  .hb-xj3-row { padding: 0 14px; gap: 10px; }\n  .hb-xj3-tag, .hb-xj3-word, .hb-xj3-newtext { display: none; }\n  .hb-xj3-new { width: 32px; padding: 0; justify-content: center; }\n  .hb-xj3-tabwrap { padding: 0 4px; }\n  .hb-xj3-tabwrap::before, .hb-xj3-tabwrap::after {\n    content: \"\";\n    position: absolute;\n    top: 0;\n    bottom: 0;\n    z-index: 2;\n    width: 28px;\n    pointer-events: none;\n  }\n  .hb-xj3-tabwrap::before { left: 0; background: linear-gradient(90deg, #0b0b0b, transparent); }\n  .hb-xj3-tabwrap::after { right: 0; background: linear-gradient(270deg, #0b0b0b, transparent); }\n}\n.hb-xj3-page { padding: 28px 20px; display: grid; gap: 14px; }\n.hb-xj3-ph { display: flex; justify-content: space-between; align-items: end; }\n.hb-xj3-ph h2 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.03em; }\n.hb-xj3-ph p { margin: 4px 0 0; color: #8f8f8f; font-size: 13px; }\n.hb-xj3-cards { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }\n.hb-xj3-card { border: 1px solid #1f1f1f; border-radius: 12px; background: #111; padding: 16px; }\n.hb-xj3-card h3 { margin: 0; color: #a1a1a1; font-size: 12px; font-weight: 500; }\n.hb-xj3-card b { display: block; margin-top: 6px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }\n.hb-xj3-spark { display: block; width: 100%; height: 120px; margin-top: 12px; }\n.hb-xj3-dep { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #1c1c1c; font-size: 13px; color: #d4d4d4; }\n.hb-xj3-dep:first-of-type { border-top: 0; margin-top: 8px; }\n.hb-xj3-dep i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; font-style: normal; box-shadow: 0 0 8px #22c55e; }\n.hb-xj3-dep small { margin-left: auto; color: #6b6b6b; font-size: 12px; }\n@container (max-width: 640px) { .hb-xj3-cards { grid-template-columns: 1fr; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-xj3 *, .hb-xj3 *::before, .hb-xj3 *::after { transition: none !important; animation: none !important; }\n}\n`;\n\nexport function NavbarTabsStretch({\n  brand = \"Northstar\",\n  tabs = defaultTabs,\n  value,\n  defaultValue = 1,\n  onValueChange,\n  user = { name: \"Mara Lindqvist\", initials: \"ML\" },\n  onNew,\n  newLabel = \"New\",\n  accent = \"#2f7bff\",\n  showBackdrop = true,\n  className,\n  style,\n  ...rest\n}: NavbarTabsStretchProps) {\n  const [inner, setInner] = React.useState(defaultValue);\n  const current = value ?? inner;\n  const listRef = React.useRef<HTMLUListElement>(null);\n  const edgeRef = React.useRef<HTMLSpanElement>(null);\n  const ghostRef = React.useRef<HTMLLIElement>(null);\n  const prevRef = React.useRef<number | null>(null);\n  const tabRefs = React.useRef<(HTMLAnchorElement | null)[]>([]);\n  const fillId = `hb-xj3-g${React.useId().replace(/[^a-zA-Z0-9]/g, \"\")}`;\n\n  React.useLayoutEffect(() => {\n    const list = listRef.current;\n    const edge = edgeRef.current;\n    if (!list || !edge) return;\n    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    const place = (animate: boolean) => {\n      const el = tabRefs.current[current];\n      if (!el) return;\n      const l = el.offsetLeft + 10;\n      const r = el.offsetLeft + el.offsetWidth - 10;\n      const prev = prevRef.current;\n      if (!animate || reduce || prev === null || prev === current) {\n        edge.style.transition = \"none\";\n      } else {\n        const right = current > prev;\n        const lead = `.32s cubic-bezier(.3,.9,.3,1)`;\n        const trail = `.5s cubic-bezier(.6,0,.2,1) .1s`;\n        edge.style.transition = right ? `--hb-xj3-l ${trail}, --hb-xj3-r ${lead}` : `--hb-xj3-l ${lead}, --hb-xj3-r ${trail}`;\n      }\n      edge.style.setProperty(\"--hb-xj3-l\", `${l}px`);\n      edge.style.setProperty(\"--hb-xj3-r\", `${r}px`);\n      if (animate && prev !== current) {\n        const pad = 40;\n        if (el.offsetLeft - pad < list.scrollLeft) list.scrollTo({ left: el.offsetLeft - pad, behavior: reduce ? \"auto\" : \"smooth\" });\n        else if (el.offsetLeft + el.offsetWidth + pad > list.scrollLeft + list.clientWidth)\n          list.scrollTo({ left: el.offsetLeft + el.offsetWidth + pad - list.clientWidth, behavior: reduce ? \"auto\" : \"smooth\" });\n      }\n      prevRef.current = current;\n    };\n    place(true);\n    const ro = new ResizeObserver(() => place(false));\n    ro.observe(list);\n    return () => ro.disconnect();\n  }, [current, tabs]);\n\n  const select = (i: number) => {\n    if (value === undefined) setInner(i);\n    onValueChange?.(i);\n  };\n\n  const hover = (i: number | null) => {\n    const list = listRef.current;\n    const ghost = ghostRef.current;\n    if (!list || !ghost) return;\n    if (i === null) {\n      list.dataset.hover = \"false\";\n      return;\n    }\n    const el = tabRefs.current[i];\n    if (!el) return;\n    const first = list.dataset.hover !== \"true\";\n    if (first) ghost.style.transition = \"opacity .2s ease\";\n    ghost.style.setProperty(\"--hb-xj3-gx\", `${el.offsetLeft}px`);\n    ghost.style.setProperty(\"--hb-xj3-gw\", `${el.offsetWidth}px`);\n    if (first) {\n      void ghost.offsetWidth;\n      ghost.style.transition = \"\";\n    }\n    list.dataset.hover = \"true\";\n  };\n\n  const onKey = (e: React.KeyboardEvent<HTMLAnchorElement>, i: number) => {\n    let next = -1;\n    if (e.key === \"ArrowRight\") next = (i + 1) % tabs.length;\n    else if (e.key === \"ArrowLeft\") next = (i - 1 + tabs.length) % tabs.length;\n    else if (e.key === \"Home\") next = 0;\n    else if (e.key === \"End\") next = tabs.length - 1;\n    if (next < 0) return;\n    e.preventDefault();\n    select(next);\n    tabRefs.current[next]?.focus();\n  };\n\n  return (\n    <header\n      className={[\"hb-xj3\", className].filter(Boolean).join(\" \")}\n      data-backdrop={showBackdrop ? \"true\" : \"false\"}\n      style={{ \"--hb-xj3-accent\": accent, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-navbar-tabs-stretch\" precedence=\"default\">\n        {`@property --hb-xj3-l { syntax: \"<length>\"; inherits: true; initial-value: 0px; }\n@property --hb-xj3-r { syntax: \"<length>\"; inherits: true; initial-value: 0px; }\n${css}`}\n      </style>\n      <div className=\"hb-xj3-head\">\n        <div className=\"hb-xj3-row\">\n          <a className=\"hb-xj3-brand\" href=\"#top\" aria-label={brand}>\n            <svg className=\"hb-xj3-logo\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n              <path d=\"M12 2 14.6 9.4 22 12l-7.4 2.6L12 22l-2.6-7.4L2 12l7.4-2.6Z\" fill=\"#ededed\" />\n            </svg>\n            <span className=\"hb-xj3-word\">{brand}</span>\n          </a>\n          <span className=\"hb-xj3-slash\" aria-hidden=\"true\">\n            /\n          </span>\n          <span className=\"hb-xj3-proj\">\n            <i aria-hidden=\"true\" />\n            atlas-web\n          </span>\n          <span className=\"hb-xj3-tag\">Hobby</span>\n          <span className=\"hb-xj3-grow\" />\n          <button type=\"button\" className=\"hb-xj3-new\" onClick={onNew} aria-label={newLabel}>\n            <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n              <path d=\"M8 3v10M3 8h10\" />\n            </svg>\n            <span className=\"hb-xj3-newtext\">{newLabel}</span>\n          </button>\n          {user && (\n            <span className=\"hb-xj3-av\" title={user.name} aria-label={user.name} role=\"img\">\n              {user.initials ?? user.name.slice(0, 2).toUpperCase()}\n            </span>\n          )}\n        </div>\n        <nav className=\"hb-xj3-tabwrap\" aria-label=\"Project\">\n          <ul className=\"hb-xj3-tabs\" ref={listRef} role=\"tablist\" onPointerLeave={() => hover(null)}>\n            <li className=\"hb-xj3-ghost\" ref={ghostRef} aria-hidden=\"true\" role=\"presentation\" />\n            {tabs.map((t, i) => (\n              <li key={t.href + i} role=\"presentation\">\n                <a\n                  ref={(el) => {\n                    tabRefs.current[i] = el;\n                  }}\n                  className=\"hb-xj3-tab\"\n                  href={t.href}\n                  role=\"tab\"\n                  aria-selected={i === current}\n                  tabIndex={i === current ? 0 : -1}\n                  onClick={() => select(i)}\n                  onPointerEnter={() => hover(i)}\n                  onKeyDown={(e) => onKey(e, i)}\n                >\n                  {t.label}\n                  {t.count !== undefined && <span className=\"hb-xj3-count\">{t.count}</span>}\n                </a>\n              </li>\n            ))}\n            <li role=\"presentation\" aria-hidden=\"true\" style={{ position: \"static\" }}>\n              <span className=\"hb-xj3-edge\" ref={edgeRef} />\n            </li>\n          </ul>\n        </nav>\n      </div>\n      {showBackdrop && (\n        <div className=\"hb-xj3-page\" aria-hidden=\"true\">\n          <div className=\"hb-xj3-ph\">\n            <div>\n              <h2>{tabs[current]?.label}</h2>\n              <p>atlas-web, production branch main</p>\n            </div>\n          </div>\n          <div className=\"hb-xj3-cards\">\n            <div className=\"hb-xj3-card\">\n              <h3>Requests, last 7 days</h3>\n              <b>1.84M</b>\n              <svg className=\"hb-xj3-spark\" viewBox=\"0 0 400 120\" preserveAspectRatio=\"none\">\n                <defs>\n                  <linearGradient id={fillId} x1=\"0\" x2=\"0\" y1=\"0\" y2=\"1\">\n                    <stop offset=\"0\" stopColor={accent} stopOpacity=\".35\" />\n                    <stop offset=\"1\" stopColor={accent} stopOpacity=\"0\" />\n                  </linearGradient>\n                </defs>\n                <path d=\"M0 92 L40 80 L80 86 L120 60 L160 68 L200 44 L240 52 L280 30 L320 38 L360 18 L400 24 L400 120 L0 120 Z\" fill={`url(#${fillId})`} />\n                <path d=\"M0 92 L40 80 L80 86 L120 60 L160 68 L200 44 L240 52 L280 30 L320 38 L360 18 L400 24\" fill=\"none\" stroke={accent} strokeWidth=\"2\" vectorEffect=\"non-scaling-stroke\" />\n              </svg>\n            </div>\n            <div className=\"hb-xj3-card\">\n              <h3>Recent deployments</h3>\n              <div className=\"hb-xj3-dep\">\n                <i />\n                fix: cache headers\n                <small>2m</small>\n              </div>\n              <div className=\"hb-xj3-dep\">\n                <i />\n                feat: billing page\n                <small>1h</small>\n              </div>\n              <div className=\"hb-xj3-dep\">\n                <i />\n                chore: bump deps\n                <small>5h</small>\n              </div>\n              <div className=\"hb-xj3-dep\">\n                <i />\n                docs: api limits\n                <small>1d</small>\n              </div>\n            </div>\n          </div>\n        </div>\n      )}\n    </header>\n  );\n}\n"
    }
  ]
}