Welcome to Vanilla Breeze
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
Table of contents with scroll-spy highlighting. Auto-generates from headings or enhances existing manual markup.
The <page-toc> component creates a table of contents that highlights the current section as you scroll. It supports two modes:
| Attribute | Type | Default | Description |
|---|---|---|---|
levels |
string | h2,h3 |
Comma-separated heading levels to include |
scope |
string | main |
CSS selector for content scope to scan |
title |
string | On this page |
Title shown above the ToC |
Headings inside live examples or embedded content can pollute the table of contents. Add data-toc-ignore to exclude them.
All headings inside the marked container are skipped. This is the most common pattern for doc pages with inline examples:
<div class="example" data-toc-ignore> <h2>Demo Heading</h2> <p>This heading will not appear in the ToC.</p></div>
Exclude an individual heading while keeping its siblings:
<h2 data-toc-ignore>This heading is skipped</h2><h2>This heading appears in the ToC</h2>
When the component is empty, it automatically scans the page for headings (with IDs) and builds the table of contents.
<!-- Auto-generates ToC from page headings --><page-toc></page-toc> <!-- With custom options --><page-toc levels="h2,h3,h4" scope="article" title="Contents"></page-toc>
id attributes (use heading-links to auto-generate)scope container (default: main)For progressive enhancement, provide your own markup. The component will add scroll-spy behavior without modifying your structure.
<!-- Progressive enhancement: works without JS --><page-toc> <details class="details" open> <summary class="summary">On this page</summary> <nav class="nav" aria-label="On this page"> <ul class="list"> <li class="item"> <a href="#overview" class="link">Overview</a> </li> <li class="item" data-level="1"> <a href="#installation" class="link">Installation</a> </li> <li class="item"> <a href="#usage" class="link">Usage</a> </li> <li class="item" data-level="1"> <a href="#examples" class="link">Examples</a> </li> </ul> </nav> </details></page-toc>
| Class | Purpose |
|---|---|
.details |
Collapsible container |
.summary |
ToC header/title |
.nav |
Navigation wrapper |
.list |
Links list |
.item |
List item (use data-level for nesting) |
.link |
Navigation link |
.active |
Applied to current section link (auto-managed) |
The component uses IntersectionObserver to track which section is currently visible and highlights the corresponding link.
.active class and aria-current="true"The component adapts to different screen sizes:
Common pattern: ToC in a sidebar alongside main content.
<layout-sidebar data-layout-side="right" data-width="250px"> <article> <h1>Page Title</h1> <section id="overview"> <h2>Overview</h2> <p>Content...</p> </section> <section id="usage"> <h2>Usage</h2> <p>Content...</p> </section> </article> <aside> <page-toc levels="h2,h3"></page-toc> </aside></layout-sidebar>
| Event | Detail | Description |
|---|---|---|
page-toc:navigate |
{ id: string } |
Fired when a ToC link is clicked |
const toc = document.querySelector('page-toc'); toc.addEventListener('page-toc:navigate', (event) => { console.log('Navigated to:', event.detail.id);});
| Method | Description |
|---|---|
refresh() |
Rebuild ToC after dynamic content changes |
<nav> element with aria-labelaria-current="true"prefers-reduced-motion for scroll behaviorThe component uses scoped styles via @scope. Override these properties for customization:
--color-interactive - Active link color--color-text-muted - Inactive link color--color-surface-raised - Hover background--border-width-medium - Active link borderlevels="h2,h3" for most documentation pagesdata-toc-ignore to example containers that include headings