A compact metric card: label, value, unit, and an optional signed delta.
Import¶
from manywidgets import StatExample¶
Read-only — drive it from another widget (see the linking guide). Click the button:
from ipywidgets import jsdlink
from manywidgets import Button, Stat
btn = Button(label="+1")
clicks = Stat(label="Clicks", value=0)
jsdlink((btn, "clicks"), (clicks, "value"))
display(btn, clicks)API¶
| Trait | Type | Default | Description |
|---|---|---|---|
label | Unicode | '' | Metric label. |
value | Any | '' | Displayed value. |
unit | Unicode | '' | Unit shown after the value. |
delta | Any | None | Signed change; coloured ▲ green / ▼ red. |
widget_id | Unicode | '' | Stable unique id used for cross-widget linking (auto-assigned). |