Components / navigation
Breadcrumb builder
A trail of crumbs, collapsed in the middle when it grows too long.
A builder is RenderOnce. Construct and mount it in one expression.
use gpui_kit::navigation::Breadcrumb;
Reviewed in breadcrumb.
Also drawn by reading-direction, which arranges components rather than reviewing them.
Construct
new(ident: impl Into<Ident>) -> Self
Options
Chain onto the value.
crumb(crumb: Crumb) -> Self
crumbs(crumbs: impl IntoIterator<Item = Crumb>) -> Self
max_visible(max_visible: usize) -> Self
on_select(handler: impl Fn(SharedString, &mut Window, &mut App) + 'static) -> Self
on_reveal(handler: impl Fn(Vec<SharedString>, &mut Window, &mut App) + 'static) -> Self
Example · breadcrumb
fn breadcrumb(_window: &mut Window, cx: &mut App) -> AnyElement {
let theme = cx.theme().clone();
stack(&theme)
.w(px(520.0))
.child(
Breadcrumb::new("scene.breadcrumb.short")
.crumbs([
Crumb::new("workspace", "Workspace"),
Crumb::new("runs", "Runs"),
Crumb::new("run-4821", "Indexing"),
])
.on_select(|_, _, _| {}),
)
.child(
Breadcrumb::new("scene.breadcrumb.long")
.crumbs([
Crumb::new("workspace", "Workspace"),
Crumb::new("projects", "Projects"),
Crumb::new("gpui-kit", "gpui-kit"),
Crumb::new("runs", "Runs"),
Crumb::new("run-4821", "Indexing"),
])
.max_visible(3)
.on_select(|_, _, _| {})
.on_reveal(|_, _, _| {}),
)
.into_any_element()
}