table of contents with jump links for on-page anchors.

Live preview

Install

From your site folder, run:

jprot add TocList

That downloads the self-contained component into theme/components/TocList.js,

where it is picked up automatically — the same way as any built-in component.

To remove it later, just delete that file.

Use it as a homepage section

Add an entry to the sections: list in jprot.config.js:

sections: [
  { component: 'TocList', title: 'TocList' },
]

Use it inside a page

On its own line in any Markdown file, passing the props:

:::TocList items='[{"label":"Install","url":"#install"},{"label":"Usage","url":"#usage"},{"label":"Publish","url":"#publish"}]' title="On this page"

Props

PropTypeNote
itemsarray[{ label, url }]
titlestringsmall heading

↩ Back to all elements