Skip to content
Calm motion: animations on this site only fade, with no movement

Stat ​

KPI tile: value, change, and trend

A number that people check at a glance: revenue, error rate, signups. Show the value large and thin, the change under it, and an optional trend line. For a chart that the reader studies, use Chart. For a trend in a table row, use Sparkline.

Basic
Revenue
$12,400
Up 12.5%
Error rate
2.1%
Down 0.4%
Signups
318
Down 8%
Since last week
Uptime
99.98%
No change 0%
  • delta is a number with a sign or a string. A number shows an arrow, the size, and deltaUnit (default %). A string shows as you wrote it.
  • goodWhen="down" marks a fall as good news, for example an error rate. Only bad news turns red. Good news stays ink, because color means chosen.
  • The direction is also text. A screen reader hears "Up 12.5%", "Down 0.4%", or "No change". Replace the words with labels.
  • data draws a Sparkline under the value. Name it with dataLabel.
  • The #hint slot adds a line of small text. The default slot replaces the value, for example with a CountUp.

Usage ​

ts
import { BlessStat } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
label*string—
value*string | number—
deltastring | number—change since the last period. A number shows its sign and a percent sign.
goodWhen"up" | "down""up"which direction is good news: `up` (default) or `down` (for example, error rate)
deltaUnitstring"%"unit text for the delta, read after the number (default `%`)
datanumber[]—trend line under the value
dataLabelstring—names the trend line for screen readers
labelsPartial<{ up: string; down: string; flat: string; }>—words for the direction, read by screen readers

Slots

NameScopeDescription
default—
hint—

Released under the MIT License. Character names and artwork belong to their owners.