Reference
BottomNavigation
A phone's tab bar along the bottom of the screen: each entry an icon over its words, at least 44px to press, clear of the home indicator (the safe-area inset); the current route's is marked.
BottomNavigation(label: String) { … }
Since 6.2.0
label
Inbox
Three new replies since this morning.
Example
Stack(gap: .sm) {
style { width: 360px; height: 240px; padding: 16px; contain: layout; overflow: hidden; border: 1px solid $color-border; border-radius: 24px }
Heading("Inbox").h3
Text("Three new replies since this morning.").muted
BottomNavigation(label: "Sections") {
BottomNavigation.Item("Home", to: "/", icon: "home")
BottomNavigation.Item("Learn", to: "/learn", icon: "book").prefix
BottomNavigation.Item("Reference", to: "/reference", icon: "list").prefix
BottomNavigation.Item("Play", to: "/playground", icon: "play")
}
}
On a page: the bar along the bottom of the screen
BottomNavigation(label: "Sections") {
BottomNavigation.Item("Home", to: "/", icon: "home")
BottomNavigation.Item("Recipes", to: "/recipes", icon: "book").prefix
}
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
label: | String |
| The bar'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.
No flags of its own.
Events
Every element also takes the props, the events and the attribute families listed on every element.
Slots
children
Parts
The parts of BottomNavigation are written under its name, inside it. Each is described here, with what it takes.
BottomNavigation.Item
One entry: its words, where it goes, and its icon.
BottomNavigation.Item(_ label: String, to: Path, active: Enum, icon: String)
| Prop | Type | Unset | Meaning |
|---|---|---|---|
label | String (positional) | — | Its words, under the icon |
to: | Path (required) | — | The route it links to, navigated in place; while it matches the current route it carries |
active: | one of its cases | exact match | How it decides it is the current page: unset, the route must equal
|
icon: | String | none | The name of a built-in icon, drawn over its words |
.prefix
Renders with the class wf-bottom-nav, stable across releases, so a stylesheet may target it.