Reference

Tour

A tour of the page while open: holds: each step in a card at its target: (a ref:), lit through a cut-out in the dimmed page, with Back, Next and Done; Escape ends it and writes false back. on finish hears Done, on close any end.

Tour(open: State, back: String, next: String, …) { … }

Since 6.2.0

Not toured yet

Example

wf

state touring = false state toured = "Not toured yet" Row(gap: .sm) { Button("New project", ref: newBtn).primary Button("Import", ref: importBtn) Button("Take the tour") { on click { touring = true } } } Tour(open: touring) { on finish { toured = "Tour finished" } Tour.Step(target: newBtn, title: "Start here") { Text("Make a project from a template.") } Tour.Step(target: importBtn, title: "Bring your work") { Text("Import a folder you already have.") } } Text(toured).muted

In your words

wf

state touring = false Button("Settings", ref: settingsBtn) Button("Show me") { on click { touring = true } } Tour(open: touring, back: "Previous", next: "Continue", done: "Got it", close: "Skip", of: "of") { on close { touring = false } Tour.Step(target: settingsBtn, title: "Settings") { Text("Your account lives here.") } }

Props

Props of Tour
PropTypeUnsetMeaning

open:

State (required)

—

Whether the tour is showing: a Bool state, set back to false when it ends (Done, Escape or the close button); it starts at the first step each time it opens

back:

String

Back

The back button's words; hidden on the first step

next:

String

Next

The next button's words, on every step but the last

done:

String

Done

The last step's button's words; pressing it ends the tour and fires on finish

close:

String

End the tour

The close button's accessible name (it shows ×)

of:

String

of

The word in the step count, 2 of 5

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

Events of Tour
EventSendsMeaning
on close—
on finish—

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

Slots

children

Parts

The parts of Tour are written under its name, inside it. Each is described here, with what it takes.

Tour.Step

One step: what it points at, its title, and its block.

Tour.Step(target: Element, title: String) { … }
Props of Tour.Step
PropTypeUnsetMeaning

target:

Element (required)

—

The element the step points at and lights up, by its ref: (even one written further down); unset, the card sits mid-window with nothing lit

title:

String

none

The step's heading, drawn as an h2 above its block, and the card's accessible name

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

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