Search documentation

Search guides, examples, and component APIs.

Quick links
↑↓ NavigateEnter OpenEsc Close
Get started

Blocks / Dashboards

Stat cards

A KPI overview with a period switch and export above four metric cards, each with an icon, a toned change against the previous value, a trend line, and a goal or limit bar.

bunx --bun @getweini/cli@latest add button card link progress skeleton toggle-group
Customize
  • The header holds the period switch and Export. The block emits `rangeChange` with `7d`, `30d` or `90d`, `export`, and `report` from the footer link; fetch new `stats` in response and pass `range` to start on another period.
  • Pass metrics in `stats`: `label`, `icon` (`revenue`, `customers`, `churn`, `refunds`; add a path to `icons` for more), a display `value`, the `previous` value, a `change` string, `direction`, `tone`, a `series` for the trend and an optional `goal`. Format values before passing them so the block never assumes a currency or locale.
  • `direction` and `tone` are separate on purpose: a fall in churn points down but is `positive`. One `tones` map sets the change pill, the trend line and the goal bar, and the arrow is paired with screen-reader text so color is never the only signal.
  • A `goal` of kind `target` fills in the primary color; a `limit` turns amber past 85% so a metric that is close to its ceiling stands out.
  • Each card keeps the trend on its own row under the value, so the line never crowds the label. At phone width the grid stays two columns and drops the icon and trend dates.
  • Set `loading` to show skeletons with the same anatomy, so nothing jumps when the numbers land. All visible text is in `copy`.