Stat
A key figure: a label, a value in tabular digits, a hint and a trend said in words.
- Domain
- Data display
- Support level
- Size
- 1.7 kB gzip, budget 1.5 kB
- Who uses it
- 16 files of the live products and sites import it (Verikora: 1, Folioviv: 3, Sovkora: 4, krizaka.com: 1) Counted in the dated inventory of 2026-11-23.
import { Stat, StatGrid } from "@krizaka/ui/stat";Web only — React, from @krizaka/ui/stat. Stable: its API only changes in a major version.
- Mobile · ✗ to build. The phone dashboards (a creator's earnings, Sovkora usage) write a figure and its caption by hand. issue #275
Why it is here. Used by Sovkora, Verikora, Folioviv, krizaka.com.
When to use
- On a dashboard: revenue, views, supporters.
- In a row of a few figures that compare over the same period.
When not to use
Installation
Install
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Import
import { Stat, StatGrid } from "@krizaka/ui/stat";Examples
Up
A rise, with its period.
Down
A fall, said in words next to the arrow.
Flat
No change.
Plain
Label and value only.
Revenue
€4,812
Row
A row of stats, as a dashboard shows them.
Strip
StatGrid variant="strip": two to four figures in one row, each with a sparkline (64 × 18) and its trend in words; a period slot takes the switch.
Grid
StatGrid: figures that wrap, hairlines between them, a meter under one (or a Sparkline of @krizaka/charts in chart).
Props
Stat
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | ReactNode | — | What the figure is ("Revenue"), above it. |
valuerequired | ReactNode | — | The figure, formatted by the app, in tabular digits. |
chart | ReactNode | — | Under the figure: a Sparkline of
@krizaka /charts (its own accessible summary), a Meter. |
hint | ReactNode | — | A line under the value: the period, the comparison. |
trend | StatTrend | — | The direction of the change; its arrow is decorative. |
trendLabel | ReactNode | — | The change, in words, as read and shown (e.g. "+12 % vs last week") — the arrow alone says nothing. |
StatGrid
A row of key figures. The default grid wraps with the width (a dashboard's head, the stats are its children);
variant="strip" is the discreet one: 2 to 4 figures in one row, as a dl, each with its sparkline and its trend in words.
| Prop | Type | Default | Description |
|---|---|---|---|
itemsrequired | readonly StatStripItem[] | — | 2 to 4 figures, in one row from 320 px. |
divided | boolean | — | Hairlines between the stats (default) or space only. |
minWidth | number | — | The narrowest a stat may be before the row wraps, in rem. Default 11. |
period | ReactNode | — | The period switch (7 · 30 · 90 d), above the row. |
variant | "grid" | "strip" | — | grid (default): figures that wrap, hairlines between them.
strip: the discreet row, 2 to 4 figures with their sparkline, as a description list. |
Accessibility
- The arrow is decorative;
trendLabelis read and shown. - Colour is never the only signal of the trend.
- The strip is a description list: each figure reads its label, its value, then its trend in words; a truncated label keeps its full text as its title.
Best practices
- Format the value in the app (currency, compact numbers) with
@krizaka/intl. - In a narrow column (a side panel, 26 rem) use
StatGrid variant="strip", never fourStats stacked full width. - Put a
Sparklineof @krizaka/charts (or aMeter) inchart: the figure first, its shape under it. - Say the change in
trendLabel(“+12 %”) and the period inhint: the arrow alone says nothing.
Related components
Generated from the code of @krizaka/ui 5.3.4: its meta.ts, its examples and its types.Edit this documentation on GitHub