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
Start here
Make a project from a template.
Bring your work
Import a folder you already have.
Not toured yet
Example
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
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
| Prop | Type | Unset | Meaning |
|---|---|---|---|
open: | State (required) | — | Whether the tour is showing: a |
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 |
close: | String | End the tour | The close button's accessible name (it shows ×) |
of: | String | of | The word in the step count, |
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
| Event | Sends | Meaning |
|---|---|---|
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) { … }
| Prop | Type | Unset | Meaning |
|---|---|---|---|
target: | Element (required) | — | The element the step points at and lights up, by its |
title: | String | none | The step's heading, drawn as an |
Renders with the class wf-tour, stable across releases, so a stylesheet may target it.
Codes this can raise
These controls list the props' cases; the example below shows them written.