StatCard
v1.0.6Updated 29 Jul 2026KPI tile showing a single big number, delta vs prior period, and optional sparkline. Stack 3-6 in a row at the top of dashboards. Supports a colorful mode that hashes the title to a deterministic palette hue for "rainbow
Preview
Live · 26 stories▸Why this is recommendedkpistatmetricdashboard+6
StatCard — outstanding default.
- ✓Dashboard KPI rows
- ✓Detail page summary tiles
- ✓Reporting "at a glance" rows
- ✓Colourful executive overviews
- Big numeric value
- Delta indicator (up/down + percent)
- Optional sparkline
- Optional icon
- Trend tone (positive / negative / neutral)
- Compact / normal size
- Colorful mode (colorful) hashes title -> hue from STAT_CARD_PALETTE for stable per-tile colours
- paletteOverride prop to pin a specific palette entry
- Exports hashTitleToHue / paletteForTitle / STAT_CARD_PALETTE helpers
- i18n: labels prop overrides the info-button and bar-sparkline aria-labels; counts format via LocaleProvider (DEFAULT_STAT_CARD_LABELS)
- ✕Long-form metrics (put in a table)
- ✕Single tiny metric inline (use a Badge)
Install
Ask your agent, or call the MCP tool directly. The resolved bundle is written into your project.
Usage
Tick variants in the left menu — each adds a tab with that variant’s real story source, the same code the preview above renders.
Props
labelMetric label
yesvaluePrimary value
yesdeltaPercentage change (renders a trend glyph via deltaDirection)
—captionNeutral secondary text under the value, with NO trend glyph — use instead of delta when a metric has no meaningful direction (a flat delta would falsely imply a trend). MCP feedback fb_707b287d.
—iconGlyph shown with the label
—iconPositionWhere icon sits: 'inline' (default, before the label — byte-identical) or 'top-right' as a corner badge (the common KPI-tile layout). MCP feedback fb_ad6d583d.
—sparkSparkline data points
—toneSemantic card tone; aligns with the catalog-wide Tone vocabulary. 'default' is kept as a byte-identical alias of 'neutral'.
—colorfulHash title to a deterministic palette hue
—paletteOverridePin a specific palette entry instead of hashing
—labelsOverride built-in UI strings (info-button aria, bar-sparkline aria template 'Bar trend over {count} points') for i18n; English defaults exported as DEFAULT_STAT_CARD_LABELS. Point counts format via LocaleProvider
—Every tonal component shares the same tone × emphasis API, so the pair looks identical across Button, Badge, Alert and more.