Stat
A key figure: a label, a value in tabular digits, a hint and a trend said in words.
- Domaine
- Affichage de données
- Niveau de support
- Taille
- 1.7 kB gzip, budget 1.5 kB
- Qui l'utilise
- 16 fichiers des produits et sites en production l'importent (Verikora : 1, Folioviv : 3, Sovkora : 4, krizaka.com : 1) Compté dans l'inventaire daté du 2026-11-23.
import { Stat, StatGrid } from "@krizaka/ui/stat";Web uniquement — React, depuis @krizaka/ui/stat. Stable : son API ne change qu’à une version majeure.
- Mobile · ✗ à construire. The phone dashboards (a creator's earnings, Sovkora usage) write a figure and its caption by hand. issue #275
Pourquoi il est là. Used by Sovkora, Verikora, Folioviv, krizaka.com.
Quand l’utiliser
- On a dashboard: revenue, views, supporters.
- In a row of a few figures that compare over the same period.
Quand ne pas l’utiliser
Installation
Installer
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Importer
import { Stat, StatGrid } from "@krizaka/ui/stat";Exemples
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 | Défaut | Description |
|---|---|---|---|
labelrequis | ReactNode | — | What the figure is ("Revenue"), above it. |
valuerequis | 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 | Défaut | Description |
|---|---|---|---|
itemsrequis | 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. |
Accessibilité
- 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.
Bonnes pratiques
- 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.
Composants liés
Générée depuis le code de @krizaka/ui 5.3.4 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub