Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Stat

A compact metric card: label, value, unit, and an optional signed delta.

Import

from manywidgets import Stat

Example

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

TraitTypeDefaultDescription
labelUnicode''Metric label.
valueAny''Displayed value.
unitUnicode''Unit shown after the value.
deltaAnyNoneSigned change; coloured ▲ green / ▼ red.
widget_idUnicode''Stable unique id used for cross-widget linking (auto-assigned).