Skip to content

Stat

Display a single metric with a label, value, supporting context, and an optional trend arrow.

  • stable
  • since v0.1.0
  • 1.5 kB
  • data-display
  • metric
  • kpi

Semantic label / value / help structure; StatArrow exposes an aria-label so the trend direction is announced.

Preview
Open
tsx

Use StatArrow to surface direction. direction="increase" (default) renders an upward chevron; direction="decrease" flips it. The arrow exposes an aria-label so screen readers announce the trend.

Preview
Open
tsx

StatHelp is the slot for comparison context — period-over-period deltas, percentages, or a short explanation.

Preview
Open
tsx

Group multiple Stats in a CSS grid for KPI dashboards.

Preview
Open
tsx
PropTypeDefaultDescription
  • Label, value, and help text share a semantic relationship via DOM proximity — screen readers announce them together.
  • StatArrow carries an aria-label ("Increased by" / "Decreased by") so the trend direction is announced even when colour alone is ignored.
  • Color is never the sole cue for direction — pair the arrow with a number or word.
  • The default icons are decorative (rendered by Lucide); pass children to override with your own glyph.
  • Use a heading or aria-label on the surrounding card / region when the metric needs more context.
  • Group multiple Stats in a Grid for KPI dashboards.
  • Use StatHelp for percentage changes or comparison context (“vs last week”, “year to date”).
  • Combine with LinearProgress for goal-tracking widgets — Stat reports the number, LinearProgress shows progress toward the goal.
  • Wrap a Stat inside a Card with variant="elevated" for a featured metric on a dashboard.