Expand description
Sidebar — a vertical navigation panel with icon + label items.
Build the items inside the show closure; each
item gets an auto-incrementing index. The currently
selected index is passed in for highlighting, and the index clicked this
frame is returned. Set collapsed for an icon-only
rail (labels move into hover tooltips).
ⓘ
let clicked = sc::Sidebar::new("nav")
.selected(self.page)
.collapsed(self.collapsed)
.show(ui, |s| {
s.header("Workspace");
s.item(sc::IconKind::Home, "Home"); // 0
s.item(sc::IconKind::File, "Documents"); // 1
s.item(sc::IconKind::Settings, "Settings"); // 2
});
if let Some(i) = clicked { self.page = i; }Structs§
- Rail
Rail— a compact, always-icon-only vertical navigation strip.- RailUi
- Builder handed to the
Rail::showclosure. - Sidebar
- Sidebar
Ui - Builder handed to the
Sidebar::showclosure.