Breadcrumbs
The path to the current location. Parts are strings or (icon, text) tuples; on_press receives the index of the clicked part.
ui.breadcrumbs · Category: Navigation · Full reference →


pz.column([ ui.breadcrumbs(["src", "ui", "button.rs"]), ui.breadcrumbs([("folder", "src"), ("file-code", "main.rs"), "fn main"], on_press=on_press), ui.breadcrumbs(["Settings", "Editor", "Font"], separator="/"),], spacing=14)When to use
Section titled “When to use”- Above an editor or a nested view, to show where you are and jump to a parent.
import pyzed as pzfrom pyzed import ui
pz.column([ ui.breadcrumbs(["src", "ui", "button.rs"]), ui.breadcrumbs([("folder", "src"), ("file-code", "main.rs"), "fn main"], on_press=on_press), ui.breadcrumbs(["Settings", "Editor", "Font"], separator="/"),], spacing=14)Variants
Section titled “Variants”Options
Section titled “Options”

Code
ui.breadcrumbs(["src", "ui", "button.rs"])

Code
ui.breadcrumbs([("folder", "src"), ("file-code", "main.rs"), "fn main"])

separator="/"Code
ui.breadcrumbs(["Settings", "Editor", "Font"], separator="/")

on_press=Code
ui.breadcrumbs(["Home", "Projects", "pyzed"], on_press=on_press)States and events
Section titled “States and events”

max_items=3Code
ui.breadcrumbs(["pyzed", "python", "pyzed", "ui", "lists.py"], max_items=3, on_press=on_press, on_more=on_more)Events
Section titled “Events”Breadcrumbs has 2 events of its own, listed below. Like every widget it also has the 18 common events (click, double_click, right_click, mouse_enter, drag, key_down, resize…), attached with .on(...): see Events and Events of every component.
| Event | Handler gets | When |
|---|---|---|
on_press |
(index) |
Called with the index of the clicked part. |
on_more |
() |
Makes the … clickable. |
Handler gets is what Pyzed passes to your callable: () means nothing. Any handler can also be a message (a value that is not callable), which goes to update().
Handling the events
Section titled “Handling the events”The same events written three ways. Imperative: methods of the app change self. Declarative: the handlers produce messages and one update() decides. Functional: a pure function draws an immutable state and asks for changes with set_state(...). See Imperative, declarative and functional.
class Browser(pz.App): def __init__(self): self.path = ["home", "ada", "projects", "pyzed"]
def go(self, index): # on_press: the index of the clicked part self.path = self.path[:index + 1]
def view(self): return ui.breadcrumbs(self.path, on_press=self.go, max_items=3, on_more=lambda: self.go(0)) # the … of the hidden partsfrom dataclasses import dataclass
@dataclassclass GoTo: index: int
class Browser(pz.App): path = ["home", "ada", "projects", "pyzed"]
def update(self, message): match message: case GoTo(index): self.path = self.path[:index + 1]
def view(self): return ui.breadcrumbs(self.path, on_press=GoTo)from dataclasses import dataclass
@dataclass(frozen=True)class State: path: tuple = ("home", "ada", "projects", "pyzed")
def view(state, set_state): return ui.breadcrumbs(list(state.path), on_press=lambda i: set_state(path=state.path[:i + 1]))Properties and API
Section titled “Properties and API”ui.breadcrumbs
Section titled “ui.breadcrumbs”breadcrumbs( parts, *, separator='›', on_press=None, max_items=None, on_more=None, theme=None,)src › main.rs › fn main. Parts can be strings or (icon, text) tuples.
| Property | Default | Description |
|---|---|---|
parts |
required | The parts. |
separator |
"›" |
Separator. |
max_items |
None |
Keeps the first part and the last ones and shows … for the rest. |
theme |
None |
Theme to use instead of the current one (pyzed.theme.current()). |
Events: on_press, on_more (events).