Indicator
The Indicator component renders a compact KPI-style card for displaying a metric value, an optional label, and an optional delta (change) badge.
It is useful for dashboards and summaries such as:
- number of users
- revenue / costs
- accuracy / AUC / latency
- conversion rate changes
- experiment comparisons
Indicators can be displayed:
- as a single card, or
- as a responsive row of cards (by passing a list of
Indicatorobjects).
Basic Usage
Section titled “Basic Usage”Single Indicator
Section titled “Single Indicator”import mercury as mr
mr.Indicator( value="123", label="Users", delta=5.4)valueis displayed as the main metriclabelis shown above the valuedeltashows an up/down badge (green/red) if numeric
Delta (Change Badge)
Section titled “Delta (Change Badge)”delta can be numeric or text:
- numeric
delta > 0→ green badge with ↑ - numeric
delta < 0→ red badge with ↓ - non-numeric delta → displayed as-is (no arrow logic)
mr.Indicator(value="98%", label="Accuracy", delta=-1.2)mr.Indicator(value="OK", label="Status", delta="stable")Multiple Indicators in One Row
Section titled “Multiple Indicators in One Row”To render a row of indicators, pass a list of Indicator objects as the value
of another Indicator:
import mercury as mr
mr.Indicator([ mr.Indicator(value="123", label="Users", delta=5.4), mr.Indicator(value="98%", label="Accuracy", delta=-1.2), mr.Indicator(value="1.3s", label="Latency"),])The row is responsive:
- on wide screens it displays as a row of cards
- on small screens it switches to a single-column layout
Styling
Section titled “Styling”You can customize colors per indicator:
import mercury as mr
mr.Indicator( value="$12,340", label="Revenue", delta=3.1, background_color="#fff", border_color="#ebebeb", value_color="#222", label_color="#555",)Indicator Params
Section titled “Indicator Params”value (required)
Section titled “value (required)”type: any
Main value displayed in the card.
Special case:
- if
valueis a list ofIndicatorinstances, they are rendered together as a row.
type: string
Optional label shown above the value.
Default: ""
type: float | string | None
Optional change badge.
- numeric → shows arrow and color logic
- string → shown as provided
None→ no badge
Default: None
background_color
Section titled “background_color”type: string
Card background color.
Default: "#fff"
border_color
Section titled “border_color”type: string
Card border color.
Default: "#ebebeb"
value_color
Section titled “value_color”type: string
Text color of the main value.
Default: "#222"
label_color
Section titled “label_color”type: string
Text color of the label.
Default: "#555"
Indicatorrenders HTML using the_repr_html_protocol.- Multiple indicators can be grouped into a responsive row.
- Numeric deltas are interpreted as percentages (
abs(delta)%).