Reference

OnThisPage

The page's headings as links, the one being read marked as the reader scrolls: a table of contents beside a long page.

OnThisPage(levels: Number, label: String)

Since 6.2.0

levels

label

Deploying

Build the site

Run wf build; the output is in build/.

Choose a host

Static hosts

Any host that serves files.

Set the base path

Under a folder, name it in the config.

Example

wf

Row(gap: .lg, align: .start) { Stack { Heading("Deploying").h1 Heading("Build the site").h2 Text("Run wf build; the output is in build/.") Heading("Choose a host").h2 Heading("Static hosts").h3 Text("Any host that serves files.") Heading("Set the base path").h2 Text("Under a folder, name it in the config.") } OnThisPage(levels: 2, label: "On this page") }

Props

Props of OnThisPage
PropTypeUnsetMeaning

levels:

Number

1

How many heading levels it lists, from h2: 1 is h2 alone, 2 adds h3, up to 5

label:

String

On this page

Its title, and its accessible name (aria-label on its <nav>)

Attribute families: global, aria, data. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.

Flags and cases

A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.

No flags of its own.

Events

Every element also takes the props, the events and the attribute families listed on every element.

Slots

It takes no slots.

Drawn for it

What OnThisPage draws itself, by the class a stylesheet can select. They are not written.

Drawn for it
PartClassMeaning

OnThisPage.Title

—

Its title.

Renders with the class wf-on-this-page, stable across releases, so a stylesheet may target it.