Skip to content

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 →

CalloutCallout
  • 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 pz
from 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)

Each tint picks a matching icon; icon= chooses another.

Callout: tint="info"Callout: tint="info"
tint="info"
Code
pz.container(ui.callout("Heads up", "Pyzed 0.5 is out."), width=380)
Callout: tint="success"Callout: tint="success"
tint="success"
Code
pz.container(ui.callout("Synced", "All changes are saved.", tint="success"), width=380)
Callout: tint="warning"Callout: tint="warning"
tint="warning"
Code
pz.container(ui.callout("Unsaved changes", "Save before closing.", tint="warning"), width=380)
Callout: tint="error"Callout: tint="error"
tint="error"
Code
pz.container(ui.callout("Could not save", "The file is read-only.", tint="error"), width=380)
Callout: tint="accent"Callout: tint="accent"
tint="accent"
Code
pz.container(ui.callout("Tip", "Ctrl+Shift+P opens the palette.", tint="accent", icon="lightbulb"), width=380)
Callout: Title onlyCallout: Title only
Title only
Code
pz.container(ui.callout("Read-only file"), width=380)
Callout: actions=Callout: actions=
actions=
Code
pz.container(ui.callout("A new version is out", "Restart to update.",
actions=[ui.button("Restart", on_restart, size="sm")]), width=380)
Callout: on_dismiss=Callout: on_dismiss=
on_dismiss=
Code
pz.container(ui.callout("Welcome!", "Open a folder to start.", on_dismiss=on_dismiss), width=380)

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

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

Full reference →