Reference
Tabs
Tab strip switching between its pages: the arrow keys move between the tabs (the other way round in a right-to-left page), Home and End go to the ends.
Tabs(bind: State, value: String or Number, orientation: Enum, …) { … }
Before 5.0
orientation
horizontal
vertical
activation
automatic
manual
label
Your name, photo and the email we write to.
Pro plan, renews on 1 March.
Only an owner can delete the account.
Open: profile
Example
state tab = "profile"
Tabs(bind: tab, label: "Account") {
Tabs.Page("Profile", value: "profile") {
Text("Your name, photo and the email we write to.")
}
Tabs.Page("Billing", value: "billing") {
Text("Pro plan, renews on 1 March.")
}
Tabs.Page("Danger zone", value: "danger", disabled: true) {
Text("Only an owner can delete the account.")
}
}
Text("Open: {tab}").muted.sm
Down the side, opened with Enter
state section = "general"
Tabs(bind: section, label: "Settings").vertical.manual {
Tabs.Page("General", value: "general") { Text("Name and language") }
Tabs.Page("Members", value: "members") { Text("Who can see the project") }
}
Hearing the change
state seen = ""
Tabs(label: "Report") {
on change(v) { seen = "{v}" }
Tabs.Page("Week") { Text("This week") }
Tabs.Page("Month") { Text("This month") }
}
Related:
Navbar Sidebar AppShell BottomNavigation Breadcrumb Link Pagination Stepper PrevNext OnThisPageProps
| Prop | Type | Unset | Meaning |
|---|---|---|---|
bind: | State | the first tab | The open tab, read and written: a page's |
value: | String or Number | the first tab | The open tab, read only: a press does not change it, only |
orientation: | one of its cases | horizontal | Which way the tabs run, and which arrow keys move between them; a flag,
|
activation: | one of its cases | automatic | Whether moving the focus opens a tab; a flag,
|
label: | String | none | The tab strip's accessible name ( |
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.
.horizontal
.vertical
.automatic
.manual
Events
| Event | Sends | Meaning |
|---|---|---|
on change | — |
Every element also takes the props, the events and the attribute families listed on every element.
Slots
children
Parts
The parts of Tabs are written under its name, inside it. Each is described here, with what it takes.
Tabs.Page
One tab and its panel.
Tabs.Page(_ label: String, value: String or Number, disabled: Bool) { … }
| Prop | Type | Unset | Meaning |
|---|---|---|---|
label | String (positional) |
| The words on its tab button |
value: | String or Number | its place from 0 | What the Tabs' |
disabled: | Bool | false | Shown, but cannot be opened: the button is disabled and the arrow keys pass over it; |
.disabled
Renders with the class wf-tabs, stable across releases, so a stylesheet may target it.