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 →


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"),)When to use
Section titled “When to use”- At the top of a
ui.workspace, or of any window withdecorations=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"),)Variants
Section titled “Variants”Title buttons
Section titled “Title buttons”

Code
ui.title_button("pyzed", on_projects)

chevron=TrueCode
ui.title_button("pyzed", on_projects, chevron=True)

muted=True, icon=Code
ui.title_button("main", on_branches, icon="git-branch", muted=True)

start=Code
pz.container(ui.title_bar([ui.title_button("pyzed", chevron=True)]), width=420)

center=Code
pz.container(ui.title_bar([], [], center=ui.muted("notes.py — Notes")), width=420)

end=Code
pz.container(ui.title_bar([], [ui.icon_button("bell", on_bell, size="sm"), ui.avatar("KV")]), width=420)Events
Section titled “Events”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().
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 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"))from dataclasses import dataclass
@dataclassclass Pick: what: str
class Ide(pz.App): picking = None
def update(self, message): match message: case Pick(what): self.picking = what
def view(self): return ui.title_bar([ui.title_button("pyzed", Pick("project"), chevron=True), ui.title_button("main", Pick("branch"), icon="git-branch", muted=True)])from dataclasses import dataclass
@dataclass(frozen=True)class State: project: str = "pyzed" projects: tuple = ("pyzed", "notes")
def view(state, set_state): nxt = state.projects[(state.projects.index(state.project) + 1) % len(state.projects)] return ui.title_bar([ui.title_button(state.project, lambda: set_state(project=nxt), chevron=True)])Properties and API
Section titled “Properties and API”ui.title_bar
Section titled “ui.title_bar”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()). |
ui.title_button
Section titled “ui.title_button”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).