Components
BaseTableOfContents
An “On this page” list that scrolls to each section and highlights the one you are reading.
Example
Install
Clicking an entry scrolls to its section and the marker slides to it.
Configure
Clicking an entry scrolls to its section and the marker slides to it.
Environment
Clicking an entry scrolls to its section and the marker slides to it.
Theme
Clicking an entry scrolls to its section and the marker slides to it.
Deploy
Clicking an entry scrolls to its section and the marker slides to it.
The aside of these docs and of the help center articles is this component. Entries can take children for subsections, shown indented. A marker in the primary colour slides to the active entry, and "Back to top" appears once you scroll down.
On small screens
With variant="menu" the table of contents becomes a dropdown with the current section. These docs and the help articles pin it above the content below lg, where the aside does not fit.
API
Props
Name | Type | Default | Description |
|---|---|---|---|
itemsrequired | BaseTableOfContentsItem[] | — | The entries, each with the id of its section, a title and optional children for subsections. |
label | string | — | The heading above the list. Defaults to toc.label. |
offset | number | 140 | How far from the top, in pixels, a section counts as reached. Match it to your sticky header. |
variant | "list" | "menu" | "list" | list (the aside) or menu (a dropdown for small screens). |
back-to-top | boolean | true | Shows "Back to top" at the end of the list once you scroll down. |
Accessibility
It renders a nav labelled by its heading and marks the active entry with aria-current="location". Clicking an entry updates the URL hash, so the link can be shared.