Introduction
react-toc is a library that automatically generates a Table of Contents (TOC) from your headings with scroll tracking.
Features
- 🔍 Automatically builds a nested TOC from
H2~H6elements. - 🧱 Provides ready-to-use heading components (
H2~H6) with unique, URL-friendlyid. - 🎯 Highlights the active heading as the user scrolls.
- ⚡ Smooth scrolling to sections when a TOC link is clicked.
- 🎨 Fully customizable with CSS classes and scroll options.
- 🧩 Works with React / Next.js.
- ✏️ Written in TypeScript with full type support.
Last updated on