{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "navbar-magnetic",
  "type": "registry:component",
  "title": "Navbar Magnetic",
  "description": "A studio header where every link leans toward the pointer and a soft chip stretches after it, then springs back with a slight overshoot. The call to action has a stronger pull and an arrow that straightens on hover.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "navigation",
    "navbar",
    "magnetic",
    "spring",
    "agency",
    "pointer",
    "header"
  ],
  "docs": "https://hyperblur.dev/effects/navbar-magnetic",
  "files": [
    {
      "path": "registry/hyperblur/navbar-magnetic.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/navbar-magnetic.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface NavbarMagneticLink {\n  label: string;\n  href: string;\n}\n\nexport interface NavbarMagneticProps extends Omit<React.HTMLAttributes<HTMLElement>, \"children\"> {\n  brand?: string;\n  links?: NavbarMagneticLink[];\n  active?: number;\n  defaultActive?: number;\n  onActiveChange?: (index: number) => void;\n  cta?: { label: string; href: string } | null;\n  strength?: number;\n  radius?: number;\n  accent?: string;\n  showBackdrop?: boolean;\n}\n\nconst css = `\n.hb-xi3 {\n  --hb-xi3-accent: #ff7a45;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  container-type: inline-size;\n  background: #0b0a09;\n  color: #f4efe9;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-xi3 *, .hb-xi3 *::before, .hb-xi3 *::after { box-sizing: border-box; }\n.hb-xi3-bar { position: relative; z-index: 2; }\n.hb-xi3-row { display: flex; align-items: center; gap: 24px; max-width: 1160px; height: 84px; margin: 0 auto; padding: 0 28px; }\n.hb-xi3-brand { display: inline-flex; align-items: center; gap: 10px; color: #f4efe9; font-family: var(--font-grotesk, inherit); font-size: 19px; font-weight: 700; letter-spacing: -.04em; text-decoration: none; border-radius: 8px; }\n.hb-xi3-mark { position: relative; width: 26px; height: 26px; }\n.hb-xi3-mark::before { content: \"\"; position: absolute; inset: 0; border: 2px solid #f4efe9; border-radius: 50%; }\n.hb-xi3-mark::after { content: \"\"; position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--hb-xi3-accent); box-shadow: 0 0 12px var(--hb-xi3-accent); animation: hb-xi3-orbit 6s linear infinite; transform-origin: -3px 15px; }\n.hb-xi3-field { position: relative; display: flex; align-items: center; gap: 6px; margin: 0 auto; padding: 6px; list-style: none; }\n.hb-xi3-field li { display: flex; }\n.hb-xi3-link {\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  height: 44px;\n  padding: 0 18px;\n  color: rgba(244,239,233,.62);\n  font-size: 15px;\n  font-weight: 500;\n  text-decoration: none;\n  border-radius: 999px;\n  transition: color .3s ease;\n}\n.hb-xi3-blob {\n  position: absolute;\n  inset: 0;\n  border-radius: 999px;\n  background: rgba(244,239,233,.07);\n  box-shadow: 0 0 0 1px rgba(244,239,233,.08) inset;\n  opacity: 0;\n  transform: translate3d(var(--hb-xi3-bx, 0px), var(--hb-xi3-by, 0px), 0) scale(var(--hb-xi3-bs, .7));\n  transition: opacity .35s ease, transform .55s cubic-bezier(.34,1.56,.64,1);\n}\n.hb-xi3-label { position: relative; display: inline-block; transform: translate3d(var(--hb-xi3-lx, 0px), var(--hb-xi3-ly, 0px), 0); transition: transform .55s cubic-bezier(.34,1.56,.64,1); }\n.hb-xi3-link[data-near=\"true\"] .hb-xi3-blob { opacity: 1; transition: opacity .25s ease, transform .18s cubic-bezier(.2,.8,.2,1); }\n.hb-xi3-link[data-near=\"true\"] .hb-xi3-label { transition: transform .18s cubic-bezier(.2,.8,.2,1); }\n.hb-xi3-link[data-near=\"true\"], .hb-xi3-link:hover, .hb-xi3-link:focus-visible { color: #fff; }\n.hb-xi3-link[aria-current=\"page\"] { color: #fff; }\n.hb-xi3-link[aria-current=\"page\"] .hb-xi3-label::after { content: \"\"; position: absolute; left: 50%; bottom: -9px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--hb-xi3-accent); }\n.hb-xi3-cta {\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  gap: 12px;\n  height: 52px;\n  padding: 0 8px 0 22px;\n  border-radius: 999px;\n  background: #f4efe9;\n  color: #0b0a09;\n  font-size: 15px;\n  font-weight: 600;\n  text-decoration: none;\n  transform: translate3d(var(--hb-xi3-cx, 0px), var(--hb-xi3-cy, 0px), 0);\n  transition: transform .6s cubic-bezier(.34,1.56,.64,1), box-shadow .3s ease;\n  box-shadow: 0 1px 0 #fff inset, 0 10px 30px -12px rgba(255,122,69,.55);\n}\n.hb-xi3-cta[data-near=\"true\"] { transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease; box-shadow: 0 1px 0 #fff inset, 0 14px 36px -10px rgba(255,122,69,.75); }\n.hb-xi3-cta-t { transform: translate3d(calc(var(--hb-xi3-cx, 0px) * .35), calc(var(--hb-xi3-cy, 0px) * .35), 0); transition: inherit; }\n.hb-xi3-dot { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--hb-xi3-accent); color: #fff; overflow: hidden; }\n.hb-xi3-dot svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transform: rotate(-45deg); transition: transform .45s cubic-bezier(.34,1.56,.64,1); }\n.hb-xi3-cta:hover .hb-xi3-dot svg, .hb-xi3-cta:focus-visible .hb-xi3-dot svg { transform: rotate(0deg); }\n.hb-xi3-cta:active { scale: .97; }\n.hb-xi3-burger { display: none; align-items: center; gap: 10px; height: 44px; margin: 0 0 0 auto; padding: 0 16px; border: 1px solid rgba(244,239,233,.16); border-radius: 999px; background: transparent; color: #f4efe9; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }\n.hb-xi3-burger i { position: relative; display: block; width: 14px; height: 8px; font-style: normal; }\n.hb-xi3-burger i::before, .hb-xi3-burger i::after { content: \"\"; position: absolute; left: 0; right: 0; height: 1.6px; border-radius: 2px; background: currentColor; transition: transform .4s cubic-bezier(.7,0,.2,1), top .4s cubic-bezier(.7,0,.2,1); }\n.hb-xi3-burger i::before { top: 0; }\n.hb-xi3-burger i::after { top: 6.4px; }\n.hb-xi3-burger[aria-expanded=\"true\"] i::before { top: 3.2px; transform: rotate(45deg); }\n.hb-xi3-burger[aria-expanded=\"true\"] i::after { top: 3.2px; transform: rotate(-45deg); }\n.hb-xi3-sheet { display: none; }\n.hb-xi3 a:focus-visible, .hb-xi3 button:focus-visible { outline: 2px solid var(--hb-xi3-accent); outline-offset: 3px; }\n.hb-xi3-stage { position: relative; height: 620px; overflow: hidden; }\n.hb-xi3-hero { max-width: 1160px; margin: 0 auto; padding: 70px 28px 0; }\n.hb-xi3-tag { display: inline-flex; align-items: center; gap: 10px; color: rgba(244,239,233,.6); font-size: 14px; }\n.hb-xi3-tag::before { content: \"\"; width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 4px rgba(61,220,132,.15); }\n.hb-xi3-h { margin: 24px 0 0; font-family: var(--font-grotesk, var(--font-sans, ui-sans-serif, system-ui, sans-serif)); font-size: clamp(44px, 10cqi, 128px); font-weight: 700; letter-spacing: -.06em; line-height: .9; }\n.hb-xi3-h span { color: var(--hb-xi3-accent); }\n.hb-xi3-foot { display: flex; justify-content: space-between; gap: 24px; margin-top: 44px; color: rgba(244,239,233,.55); font-size: 15px; line-height: 1.5; }\n.hb-xi3-foot p { max-width: 360px; margin: 0; }\n.hb-xi3-logos { display: flex; gap: 28px; align-items: center; color: rgba(244,239,233,.38); font-family: var(--font-grotesk, inherit); font-weight: 700; letter-spacing: -.02em; }\n@keyframes hb-xi3-orbit { to { transform: rotate(360deg); } }\n@keyframes hb-xi3-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }\n@container (max-width: 820px) {\n  .hb-xi3-field, .hb-xi3-cta { display: none; }\n  .hb-xi3-burger { display: inline-flex; }\n  .hb-xi3-row { height: 68px; padding: 0 18px; }\n  .hb-xi3-sheet[data-open=\"true\"] { display: grid; gap: 4px; padding: 6px 18px 22px; border-bottom: 1px solid rgba(244,239,233,.08); }\n  .hb-xi3-sheet a { display: flex; align-items: baseline; gap: 14px; padding: 8px 0; color: #f4efe9; font-family: var(--font-grotesk, inherit); font-size: 32px; font-weight: 600; letter-spacing: -.04em; text-decoration: none; animation: hb-xi3-rise .5s cubic-bezier(.2,.8,.2,1) both; }\n  .hb-xi3-sheet a small { color: rgba(244,239,233,.4); font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; letter-spacing: 0; }\n  .hb-xi3-sheet a[aria-current=\"page\"] { color: var(--hb-xi3-accent); }\n  .hb-xi3-sheet .hb-xi3-sheet-cta { display: inline-flex; justify-content: center; align-items: center; margin-top: 12px; height: 50px; border-radius: 999px; background: #f4efe9; color: #0b0a09; font-family: inherit; font-size: 15px; letter-spacing: 0; }\n  .hb-xi3-foot { flex-direction: column; }\n  .hb-xi3-logos { display: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-xi3 *, .hb-xi3 *::before, .hb-xi3 *::after { animation: none !important; transition: none !important; }\n}\n`;\n\nconst defaultLinks: NavbarMagneticLink[] = [\n  { label: \"Work\", href: \"#\" },\n  { label: \"Services\", href: \"#\" },\n  { label: \"Studio\", href: \"#\" },\n  { label: \"Journal\", href: \"#\" },\n  { label: \"Contact\", href: \"#\" },\n];\n\nexport function NavbarMagnetic({\n  brand = \"Orbit\",\n  links = defaultLinks,\n  active,\n  defaultActive = 0,\n  onActiveChange,\n  cta = { label: \"Start a project\", href: \"#\" },\n  strength = 0.4,\n  radius = 90,\n  accent = \"#ff7a45\",\n  showBackdrop = true,\n  className = \"\",\n  style,\n  ...rest\n}: NavbarMagneticProps) {\n  const uid = React.useId();\n  const [inner, setInner] = React.useState(defaultActive);\n  const [open, setOpen] = React.useState(false);\n  const current = active ?? inner;\n  const rowRef = React.useRef<HTMLElement>(null);\n  const frame = React.useRef(0);\n  const point = React.useRef<{ x: number; y: number } | null>(null);\n\n  const apply = React.useCallback(() => {\n    frame.current = 0;\n    const row = rowRef.current;\n    if (!row) return;\n    const p = point.current;\n    row.querySelectorAll<HTMLElement>(\"[data-hb-xi3-mag]\").forEach((el) => {\n      const isCta = el.dataset.hbXi3Mag === \"cta\";\n      const r = el.getBoundingClientRect();\n      const cx = r.left + r.width / 2;\n      const cy = r.top + r.height / 2;\n      const reach = isCta ? radius * 1.3 : radius;\n      if (!p) {\n        el.dataset.near = \"false\";\n        el.style.removeProperty(isCta ? \"--hb-xi3-cx\" : \"--hb-xi3-lx\");\n        el.style.removeProperty(isCta ? \"--hb-xi3-cy\" : \"--hb-xi3-ly\");\n        el.style.removeProperty(\"--hb-xi3-bx\");\n        el.style.removeProperty(\"--hb-xi3-by\");\n        el.style.removeProperty(\"--hb-xi3-bs\");\n        return;\n      }\n      const dx = p.x - cx;\n      const dy = p.y - cy;\n      const half = Math.max(r.width, r.height) / 2;\n      const d = Math.hypot(dx, dy);\n      const near = d < half + reach * 0.35;\n      const pull = Math.max(0, 1 - Math.max(0, d - half * 0.5) / (half + reach));\n      const k = strength * pull;\n      el.dataset.near = near ? \"true\" : \"false\";\n      if (isCta) {\n        el.style.setProperty(\"--hb-xi3-cx\", `${(dx * k * 0.6).toFixed(2)}px`);\n        el.style.setProperty(\"--hb-xi3-cy\", `${(dy * k * 0.6).toFixed(2)}px`);\n        return;\n      }\n      el.style.setProperty(\"--hb-xi3-lx\", `${(dx * k * 0.5).toFixed(2)}px`);\n      el.style.setProperty(\"--hb-xi3-ly\", `${(dy * k * 0.5).toFixed(2)}px`);\n      el.style.setProperty(\"--hb-xi3-bx\", `${(dx * k * 0.28).toFixed(2)}px`);\n      el.style.setProperty(\"--hb-xi3-by\", `${(dy * k * 0.28).toFixed(2)}px`);\n      el.style.setProperty(\"--hb-xi3-bs\", near ? (1 + pull * 0.06).toFixed(3) : \".7\");\n    });\n  }, [radius, strength]);\n\n  React.useEffect(() => () => window.cancelAnimationFrame(frame.current), []);\n\n  const schedule = () => {\n    if (!frame.current) frame.current = window.requestAnimationFrame(apply);\n  };\n\n  const onMove = (e: React.PointerEvent<HTMLElement>) => {\n    if (e.pointerType !== \"mouse\") return;\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    point.current = { x: e.clientX, y: e.clientY };\n    schedule();\n  };\n  const onLeave = () => {\n    point.current = null;\n    schedule();\n  };\n\n  const select = (i: number) => {\n    if (active === undefined) setInner(i);\n    onActiveChange?.(i);\n    setOpen(false);\n  };\n\n  return (\n    <header\n      className={`hb-xi3 ${className}`}\n      style={{ \"--hb-xi3-accent\": accent, ...style } as React.CSSProperties}\n      onKeyDown={(e) => {\n        if (e.key === \"Escape\" && open) setOpen(false);\n      }}\n      {...rest}\n    >\n      <style href=\"hb-navbar-magnetic\" precedence=\"default\">\n        {css}\n      </style>\n      <div className=\"hb-xi3-bar\">\n        <nav ref={rowRef} className=\"hb-xi3-row\" aria-label=\"Main\" onPointerMove={onMove} onPointerLeave={onLeave}>\n          <a href=\"#\" className=\"hb-xi3-brand\" aria-label={`${brand} home`}>\n            <span className=\"hb-xi3-mark\" aria-hidden=\"true\" />\n            {brand}\n          </a>\n          <ul className=\"hb-xi3-field\">\n            {links.map((link, i) => (\n              <li key={link.label}>\n                <a\n                  href={link.href}\n                  className=\"hb-xi3-link\"\n                  data-hb-xi3-mag=\"link\"\n                  data-near=\"false\"\n                  aria-current={i === current ? \"page\" : undefined}\n                  onClick={() => select(i)}\n                >\n                  <span className=\"hb-xi3-blob\" aria-hidden=\"true\" />\n                  <span className=\"hb-xi3-label\">{link.label}</span>\n                </a>\n              </li>\n            ))}\n          </ul>\n          {cta && (\n            <a href={cta.href} className=\"hb-xi3-cta\" data-hb-xi3-mag=\"cta\" data-near=\"false\">\n              <span className=\"hb-xi3-cta-t\">{cta.label}</span>\n              <span className=\"hb-xi3-dot\" aria-hidden=\"true\">\n                <svg viewBox=\"0 0 16 16\">\n                  <path d=\"M3 8h10M9 4l4 4-4 4\" />\n                </svg>\n              </span>\n            </a>\n          )}\n          <button\n            type=\"button\"\n            className=\"hb-xi3-burger\"\n            aria-expanded={open}\n            aria-controls={`${uid}-sheet`}\n            onClick={() => setOpen((v) => !v)}\n          >\n            {open ? \"Close\" : \"Menu\"}\n            <i aria-hidden=\"true\" />\n          </button>\n        </nav>\n        <div id={`${uid}-sheet`} className=\"hb-xi3-sheet\" data-open={open ? \"true\" : \"false\"}>\n          {links.map((link, i) => (\n            <a\n              key={link.label}\n              href={link.href}\n              aria-current={i === current ? \"page\" : undefined}\n              style={{ animationDelay: `${(i * 0.05).toFixed(2)}s` }}\n              onClick={() => select(i)}\n            >\n              <small>{String(i + 1).padStart(2, \"0\")}</small>\n              {link.label}\n            </a>\n          ))}\n          {cta && (\n            <a href={cta.href} className=\"hb-xi3-sheet-cta\" onClick={() => setOpen(false)}>\n              {cta.label}\n            </a>\n          )}\n        </div>\n      </div>\n      {showBackdrop && (\n        <div className=\"hb-xi3-stage\" aria-hidden=\"true\">\n          <div className=\"hb-xi3-hero\">\n            <span className=\"hb-xi3-tag\">Booking projects for March 2027</span>\n            <h2 className=\"hb-xi3-h\">\n              We build brands\n              <br />\n              that <span>move.</span>\n            </h2>\n            <div className=\"hb-xi3-foot\">\n              <p>Identity, product and motion for founders who would rather be remembered than merely seen. Based in Lisbon, working everywhere.</p>\n              <div className=\"hb-xi3-logos\">\n                <span>Northwind</span>\n                <span>Kestrel</span>\n                <span>Pallas</span>\n                <span>Fjord</span>\n              </div>\n            </div>\n          </div>\n        </div>\n      )}\n    </header>\n  );\n}\n"
    }
  ]
}