Krizaka UI
Krizaka UI

Stat

A key figure: a label, a value in tabular digits, a hint and a trend said in words.

Web · ✓Mobile · ✗ à construireBureau · ✓StableAffichage de données
Niveau de support
Stable
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

  • For figures inside an item's card.À la place : Card
  • For progress towards a goal.À la place : Progress
  • For a status.À la place : Badge

Installation

Installer

npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcss

Styles

@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

PropTypeDéfautDescription
labelrequisReactNode—What the figure is ("Revenue"), above it.
valuerequisReactNode—The figure, formatted by the app, in tabular digits.
chartReactNode—Under the figure: a Sparkline of @krizaka /charts (its own accessible summary), a Meter.
hintReactNode—A line under the value: the period, the comparison.
trendStatTrend—The direction of the change; its arrow is decorative.
trendLabelReactNode—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.

PropTypeDéfautDescription
itemsrequisreadonly StatStripItem[]—2 to 4 figures, in one row from 320 px.
dividedboolean—Hairlines between the stats (default) or space only.
minWidthnumber—The narrowest a stat may be before the row wraps, in rem. Default 11.
periodReactNode—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; trendLabel is 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 four Stats stacked full width.
  • Put a Sparkline of @krizaka/charts (or a Meter) in chart: the figure first, its shape under it.
  • Say the change in trendLabel (“+12 %”) and the period in hint: the arrow alone says nothing.

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

Sur cette page