AhaSlides Design
v0.52.0React · Vue · Lit

Components · Data Display

Statistic

A single headline number with a caption, prefix/suffix (text or icon), precision, trend colour and a loading skeleton.

Examples

Trend
Prefix
Suffix
Statistic · prefix/suffix icons · precision · trend colour · loading

API

PropTypeDefaultNotes
labelstringThe caption above the value
valuestring | numberThe headline figure
precisionnumberFormat value to N decimal places with en-US thousands separators (non-numeric values left verbatim)
prefixstringSmall text before the value (e.g. a currency mark)
suffixstringSmall text after the value (e.g. %, unit)
prefix-iconicon nameA DS icon before the value (e.g. system-currency-circle-dollar)
suffix-iconicon nameA DS icon after the value
trendup | downTint the value success-green/error-red + a matching trend arrow glyph
loadingbooleanfalseShow a shimmer skeleton in place of the figure

Install

# .npmrc — once: point the @ahaslides-product scope at GitHub Packages
@ahaslides-product:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}   # a GitHub token with read:packages

npm i @ahaslides-product/design
import '@ahaslides-product/design/tokens.css';   // once, at the app root
import '@ahaslides-product/design/aha-statistic';   // registers <aha-statistic>

Agent feed for this component (absolute, fetchable anywhere): statistic.agent.json · statistic.md · statistic.llms.txt

When to use

When to use
  • Statistic — a single KPI on a dashboard or results screen
  • Badge — a small count attached to another element
  • Progress — a value's share of a whole
Caption names the metric in sentence case — 'Active players', not 'ACTIVE PLAYERS'. Use trend only when up/down carries meaning; the element pairs the tint with a trend arrow glyph so colour is never the sole signal. Reach for prefix-icon/suffix-icon (a currency mark, a %) over a decorative image; set precision for money/rates so the figure reads consistently.
Surfaces
dashboard audience

Spec

Caption 14/22 #4A4A4A · Value 24/32 SemiBold #1A1A1A · Prefix / suffix 14/22 Regular #8A8A8A, text or a 16px DS icon · Precision value formatted to N decimals, en-US thousands separators · Trend up color-success #16C49A + trend-up glyph · down color-error #F5222D + trend-down glyph · Loading shimmer skeleton (label + value bars), motion-token animation, role=status