Count badge
A round counter for notifications or problems. Above max it shows 99+.
ui.count_badge · Category: Feedback · Full reference →


pz.row([ ui.count_badge(3), ui.count_badge(42, tint="success"), ui.count_badge(120, tint="error"), pz.row([ui.icon_button("bell", on_press), ui.count_badge(7)], spacing=2, align="center"),], spacing=16, align="center")When to use
Section titled “When to use”- Next to an icon or tab to show how many unread items or errors there are.
- For text statuses use a Badge.
import pyzed as pzfrom pyzed import ui
pz.row([ ui.count_badge(3), ui.count_badge(42, tint="success"), ui.count_badge(120, tint="error"), pz.row([ui.icon_button("bell", on_press), ui.count_badge(7)], spacing=2, align="center"),], spacing=16, align="center")Variants
Section titled “Variants”Above max it shows max+.


3Code
ui.count_badge(3)

42Code
ui.count_badge(42)

120Code
ui.count_badge(120)

max=9Code
ui.count_badge(12, max=9)

tint="success"Code
ui.count_badge(5, tint="success")

tint="warning"Code
ui.count_badge(5, tint="warning")

tint="error"Code
ui.count_badge(5, tint="error")Next to an icon
Section titled “Next to an icon”

Code
pz.row([ui.icon_button("bell", on_press), ui.count_badge(7)], spacing=2, align="center")States and events
Section titled “States and events”With show_zero=False it draws nothing at 0 but keeps its place in the layout.


show_zero=FalseCode
pz.row([ui.icon_button("bell", on_press), ui.count_badge(0, show_zero=False)], align="center")Events
Section titled “Events”Count badge has no events of its own: it shows what you give it. 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.
Properties and API
Section titled “Properties and API”ui.count_badge
Section titled “ui.count_badge”count_badge(count, *, tint='accent', max=99, show_zero=True, theme=None)A round counter (notifications, problems…). Shows 99+ above max.
| Property | Default | Description |
|---|---|---|
count |
required | The number. |
tint |
"accent" |
Semantic color: "accent", "error", "warning", "success", "info" or a token. |
max |
99 |
Maximum before showing N+. |
show_zero |
True |
With False, a count of 0 draws nothing. |
theme |
None |
Theme to use instead of the current one (pyzed.theme.current()). |
Related
Section titled “Related”BadgeA small pill for statuses, versions and counters.
IndicatorA colored dot for status, presence or unsaved changes.
Status barThe bottom bar: diagnostics, cursor position, language.