Skip to content

Title bar

The top bar of the window: widgets at the start (project and branch pickers), an optional center and widgets at the end (account, notifications). ui.title_button is the compact button it uses (pyzed ▾, main), with chevron and muted styles.

ui.title_bar · Category: Workspace · Full reference →

Title barTitle bar
  • At the top of a ui.workspace, or of any window with decorations=False.
from pyzed import ui
ui.title_bar(
[ui.title_button("pyzed", on_projects, chevron=True),
ui.title_button("main", on_branches, icon="git-branch", muted=True)],
[ui.facepile(["Ana", "Luis"]), ui.icon_button("bell", on_bell, size="sm"), ui.avatar("KV")],
center=ui.muted("notes.py"),
)
Title bar: PlainTitle bar: Plain
Plain
Code
ui.title_button("pyzed", on_projects)
Title bar: chevron=TrueTitle bar: chevron=True
chevron=True
Code
ui.title_button("pyzed", on_projects, chevron=True)
Title bar: muted=True, icon=Title bar: muted=True, icon=
muted=True, icon=
Code
ui.title_button("main", on_branches, icon="git-branch", muted=True)
Title bar: start=Title bar: start=
start=
Code
pz.container(ui.title_bar([ui.title_button("pyzed", chevron=True)]), width=420)
Title bar: center=Title bar: center=
center=
Code
pz.container(ui.title_bar([], [], center=ui.muted("notes.py — Notes")), width=420)
Title bar: end=Title bar: end=
end=
Code
pz.container(ui.title_bar([], [ui.icon_button("bell", on_bell, size="sm"), ui.avatar("KV")]), width=420)

Title bar has 1 event 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 () Message or callable sent on press. None disables the control.

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 Ide(pz.App):
def __init__(self):
self.picking = None
def view(self):
return ui.title_bar([
ui.title_button("pyzed", lambda: setattr(self, "picking", "project"), chevron=True),
ui.title_button("main", lambda: setattr(self, "picking", "branch"), icon="git-branch", muted=True),
], center=ui.muted(f"Pick a {self.picking}" if self.picking else "notes.py"))
title_bar(start=(), end=(), *, center=None, height=34, theme=None)

The top bar: project and branch pickers on the left, account and actions on the right.

Property Default Description
start () Widgets at the start (left).
end () Widgets at the end (right).
center None Centered widget.
height 34 Height.
theme None Theme to use instead of the current one (pyzed.theme.current()).

Full reference →

title_button(
content,
on_press=None,
*,
icon=None,
muted=False,
chevron=False,
theme=None,
)

A compact button for the title bar (pyzed ▾, main…).

Property Default Description
content required Text.
icon None Name of a Lucide icon (pyzed icons lists them).
muted False Muted text.
chevron False Adds a ▾.
theme None Theme to use instead of the current one (pyzed.theme.current()).

Events: on_press (events).

Full reference →