Skip to Content

<Toc>

Component that renders the table of contents based on the data from TocProvider. Must be used inside a TocProvider.

PropTypeDefaultDescription
className?string-CSS class applied to the outer <section> element.
headingClassName?string-CSS class applied to the optional heading (ex. “Contents”).
headingText?string"Contents"Text for the optional heading.
headingVisible?booleantrueshow/hide the heading above the TOC.
listClassName?string-CSS class applied to all <ul> elements in the TOC.
linkClassName?string-CSS class applied to all <a> links.
activeClassName?string-Additional CSS class applied to the active link.
offsetTop?number30Vertical offset applied when scrolling to a heading.
offsetLeft?number0Horizontal scroll offset when navigating to a heading.
scrollBehavior?"auto" | "instant" | "smooth""smooth"Determines whether scrolling is instant or animates smoothly.
expandAll?booleanfalseIf true, always show all nested levels. If false, only expand the branch containing the active heading.
Last updated on