Skip to content

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 →

BreadcrumbsBreadcrumbs
  • Above an editor or a nested view, to show where you are and jump to a parent.
import pyzed as pz
from 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)
Breadcrumbs: TextBreadcrumbs: Text
Text
Code
ui.breadcrumbs(["src", "ui", "button.rs"])
Breadcrumbs: With iconsBreadcrumbs: With icons
With icons
Code
ui.breadcrumbs([("folder", "src"), ("file-code", "main.rs"), "fn main"])
Breadcrumbs: separator="/"Breadcrumbs: separator="/"
separator="/"
Code
ui.breadcrumbs(["Settings", "Editor", "Font"], separator="/")
Breadcrumbs: on_press=Breadcrumbs: on_press=
on_press=
Code
ui.breadcrumbs(["Home", "Projects", "pyzed"], on_press=on_press)
Breadcrumbs: max_items=3Breadcrumbs: max_items=3
max_items=3
Code
ui.breadcrumbs(["pyzed", "python", "pyzed", "ui", "lists.py"], max_items=3, on_press=on_press, on_more=on_more)

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().

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 parts
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).

Full reference →