TableOfContents
The
TableOfContents component automatically discovers headings on the page (h1–h6) and renders a navigable outline with active section tracking. It supports scroll‑spy highlighting, deep-link copying, custom initial data (SSR / virtual docs), indentation control, appearance variants, and external active state notifications.Examples
(5)Properties
(28)Playground
Basics
Drop a table of contents beside your main article and it will register headings automatically through the shared title registry.
Variants
Choose between the
outline, ghost, filled, and none variants. Pair filled with autoContrast to keep labels legible against a brand color.Preloaded data
Seed the table of contents with
initialData so servers and prerender jobs can render the navigation before headings mount.Depth offset
Use
minDepthToOffset and depthOffset to indent nested headings so deep sections are easy to scan.Active callbacks
Subscribe to
onActiveChange to surface the currently highlighted section, perfect for syncing status chips or analytics.Scan to open this page on your phonereact-ui-library.com/components/TableOfContents
</>
react-ui-library
100+ accessible, themeable components that work seamlessly across iOS, Android, and Web.
A Platform Blocks product.
Quick Links
Resources