Velocity X Components

Content & Dashboard

Table of Contents (Sticky, Scroll-Spy)

Sticky table of contents with IntersectionObserver-driven scroll-spy highlighting that degrades to a plain link list without observer support.

Subscription Included with the Velocity Components subscription.
bash
$ velocityx add table-of-contents

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 Table of Contents (Sticky, Scroll-Spy) →

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

react v1.0.0 react
Table of Contents (Sticky, Scroll-Spy)

Props

NameTypeRequiredDefaultDescription
items{ id, label, depth? }[]NoDEFAULT_ITEMSdepth 0|1, 1 renders indented
titlestring,No'On this page'
classNamestringNo''

File this creates

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

text
components/velocity/table-of-contents/TableOfContents.jsx

Using the Table of Contents (Sticky, Scroll-Spy) component

Install it with velocityx add table-of-contents. 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 Content & Dashboard.