Import

import PageToc from '../../components/utility/PageToc.astro';

Usage

<div class="page-shell">
  <div class="page-main"><!-- sections with matching ids --></div>
  <PageToc items={toc} />
</div>

The component must sit in the 160px column of a .page-shell grid, and each item.id must match the id of a section element on the page (used as the scroll anchor and the scroll-spy target).

Props

PropTypeRequiredDescription
items{ id, label, sub? }[]YesSections to list. id links to the matching anchor; sub: true indents the item as a sub-section.
titlestringNoHeading and aria-label (default On this page)

Preview

Sticky centring and scroll-spy highlighting only activate on a real long page with the matching section ids — this static preview shows the resting layout only.

Page tokens