Nav TOC Scrollspy
Sticky table of contents sidebar for documentation with active section highlight.
Choose the primitives library your project already uses. Both look the same: your theme, not the variant, controls colors, shape, type and motion.
About this block
What it's for
- Sticky table of contents sidebar for documentation with active section highlight.
- On this page navigation built from h2 and h3 headings with scrollspy.
- Article outline that follows the scroll position using IntersectionObserver.
Includes
- Heading discovery
- Sticky contents
- Scrollspy
- Intersection observer
- Smooth scroll
- Focus heading
- Hash update
- Reduced motion
Works with
- Radix UI and Base UI primitives (pick the one your project uses)
- React 19 and Tailwind CSS 4 in Next.js (App Router), Vite, React Router or TanStack Start, installed with the agentic-ui or shadcn CLI
- Your theme tokens, in light and dark mode
Install
Included with Agentic UI Kit (one-time license). Install needs your license key: see pricing · connect your project.
Agentic UI CLI
agentic-ui add nav-toc-scrollspyInstalls through shadcn and adapts the component to your design tokens.
shadcn CLI
npx shadcn@4.17.0 add @agentic-ui/nav-toc-scrollspyUsed in
A standalone component: drop it into any screen.
- Type
- Block
- Variants
- Radix UI and Base UI
- Themes
- Light and dark
- Widths
- Preview it at desktop, tablet and mobile widths above.
- npm packages
- None beyond your project's React and Next.js
- Registry dependencies
lib-primitives- Files
2 files
- components/agentic-ui/nav-toc-scrollspy/nav-toc-scrollspy/nav-toc-scrollspy.tsx
- components/agentic-ui/nav-toc-scrollspy/nav-toc-scrollspy/toc-model.ts
Related components
Nav Pagination Bar
Table pagination footer with page size and jump to page.
Details and live previewA11y Contrast Badge
Check in the browser whether the theme palette meets AA before opening the PR.
Details and live previewA11y Focus Manager
Confirmation dialog that returns focus to the button that opened it.
Details and live previewA11y Live Announcer
Announce the number of results when filtering a table without reloading the page.
Details and live preview