Reference
Navbar
Top navigation bar with brand, links and action areas.
Navbar { … }
Before 5.0
No props to try.
Example
Navbar {
Navbar.Brand { Link("WebFluent", to: "/") }
Navbar.Links {
Link("Learn", to: "/learn", active: .prefix)
Link("Reference", to: "/reference", active: .prefix)
Link("Recipes", to: "/recipes")
}
Navbar.Actions {
ThemeToggle
Button("Try it").primary.sm { on click { navigate("/playground") } }
}
}
Brand and links only
Navbar {
Navbar.Brand { Text("Ledger").bold }
Navbar.Links {
Link("Showcase", to: "/showcase")
Link("Errors", to: "/errors")
}
}
Props
This element takes no props of its own.
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 Navbar are written under its name, inside it. Each is described here, with what it takes.
Navbar.Brand
The brand area, usually a link home.
Navbar.Brand { … }
Navbar.Links
The navigation links; collapses behind a toggle on small screens.
Navbar.Links { … }
Navbar.Actions
Buttons at the end of the bar.
Navbar.Actions { … }
Renders with the class wf-navbar, 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.