Velocity X Components

Standard Navigation

Anchor Scroll-Spy Nav

In-page section links that highlight themselves as the reader scrolls, so a long docs or landing page always shows where you are without you having to hunt for it. Tracks visibility with IntersectionObserver, never a scroll handler, so it costs nothing on long pages.

Subscription Included with the Velocity Components subscription.
bash
$ velocityx add standard-anchor-scroll-spy-nav

Built for react. Needs react already installed as a peer dependency. An Astro-only project needs @astrojs/react wired up first — this won't run on its own in plain Astro.

Full docs for Anchor Scroll-Spy Nav →

Needs a licence key — subscribe here, then velocityx loginonce.

react v1.0.1 react

Props

NameTypeRequiredDefaultDescription
sections{ id: string, label: string }[]No[]section ids must match DOM element ids
rootMarginstringNo'-15% 0px -70% 0px'IntersectionObserver rootMargin
labelstringNo'On this page'accessible name for the <nav>
titlestringYesoptional heading rendered above the links
classNamestringNo''

File this creates

The CLI writes this path into your project, relative to its root — nothing else moves.

text
components/velocity/standard-anchor-scroll-spy-nav/AnchorScrollSpyNav.jsx

Using the Anchor Scroll-Spy Nav component

Install it with velocityx add standard-anchor-scroll-spy-nav. The CLI writes the source straight into your project — no runtime dependency, no registry lock-in, and it themes itself from the same primary-*/accent-* scale as the rest of the library.

More from Standard Navigation.