Callout
An inline notice (a callout or banner): an icon, a title, an optional description, action buttons and a close button with on_dismiss. tint is "info" (default), "success", "warning", "error" or any theme token.
ui.callout · Category: Feedback · Full reference →


pz.column([ ui.callout("A new version is out", "Pyzed 0.4 adds the component designer.", tint="info", actions=[ui.button("What's new", on_open, size="sm")], on_dismiss=on_dismiss), ui.callout("Could not save", "The file is read-only.", tint="error"),], spacing=10, width=520)When to use
Section titled “When to use”- For messages that belong to a place in the UI: a read-only file, a new version, a failed sync.
- For short-lived messages, use a Toast.
import pyzed as pzfrom pyzed import ui
pz.column([ ui.callout("A new version is out", "Pyzed 0.4 adds the component designer.", tint="info", actions=[ui.button("What's new", on_open, size="sm")], on_dismiss=on_dismiss), ui.callout("Could not save", "The file is read-only.", tint="error"),], spacing=10, width=520)Variants
Section titled “Variants”Each tint picks a matching icon; icon= chooses another.


tint="info"Code
pz.container(ui.callout("Heads up", "Pyzed 0.5 is out."), width=380)

tint="success"Code
pz.container(ui.callout("Synced", "All changes are saved.", tint="success"), width=380)

tint="warning"Code
pz.container(ui.callout("Unsaved changes", "Save before closing.", tint="warning"), width=380)

tint="error"Code
pz.container(ui.callout("Could not save", "The file is read-only.", tint="error"), width=380)

tint="accent"Code
pz.container(ui.callout("Tip", "Ctrl+Shift+P opens the palette.", tint="accent", icon="lightbulb"), width=380)Content
Section titled “Content”

Code
pz.container(ui.callout("Read-only file"), width=380)

actions=Code
pz.container(ui.callout("A new version is out", "Restart to update.", actions=[ui.button("Restart", on_restart, size="sm")]), width=380)

on_dismiss=Code
pz.container(ui.callout("Welcome!", "Open a folder to start.", on_dismiss=on_dismiss), width=380)Events
Section titled “Events”Callout 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_dismiss |
() |
Adds a close button. |
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 Updates(pz.App): def __init__(self): self.visible = True
def view(self): if not self.visible: return ui.muted("No news.") return ui.callout("A new version is out", "Pyzed adds the component designer.", tint="info", on_dismiss=lambda: setattr(self, "visible", False)) # adds the ✕class Updates(pz.App): visible = True
def update(self, message): if message == "dismiss": self.visible = False
def view(self): return ui.callout("A new version is out", tint="info", on_dismiss="dismiss") if self.visible \ else ui.muted("No news.")from dataclasses import dataclass
@dataclass(frozen=True)class State: visible: bool = True
def view(state, set_state): if not state.visible: return ui.muted("No news.") return ui.callout("A new version is out", tint="info", on_dismiss=lambda: set_state(visible=False))Properties and API
Section titled “Properties and API”ui.callout
Section titled “ui.callout”callout( title, description=None, *, tint='info', icon=None, actions=(), on_dismiss=None, theme=None,)An inline notice (a callout or banner).
| Property | Default | Description |
|---|---|---|
title |
required | Title (text or widget). |
description |
None |
Secondary text. |
tint |
"info" |
"info", "success", "warning", "error" or "hint": picks the color and icon. |
icon |
None |
Name of a Lucide icon (pyzed icons lists them). |
actions |
() |
Extra widgets (usually buttons) shown as actions. |
theme |
None |
Theme to use instead of the current one (pyzed.theme.current()). |
Events: on_dismiss (events).