Reference

TableOfContents

The document's headings with the page each lands on, each a link to it.

TableOfContents(levels: Number, title: String)

Since 5.2.0

PDF

No preview for this one: the example below shows how it is written.

Example

wf

Document(title: "Employee handbook") { Heading("Employee handbook").h1 TableOfContents(levels: 2, title: "Contents") PageBreak Heading("Your first week").h2 Heading("Equipment").h3 Heading("Time off").h2 }

Props

Props of TableOfContents
PropTypeUnsetMeaning

levels:

Number

3

The deepest heading level listed: 1 is the h1s only, 2 adds the h2s

title:

String

none

A heading (<h2>) above the list

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.

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

These controls list the props' cases; the example below shows them written.