Krizaka UI
Krizaka UI
ComponentsData display

KPI stat

A key figure with its change against the previous period and a sparkline of the period, on the kit's Stat.

Web · ✓Mobile · ✗ to buildDesktop · ✓BetaCharts
Support level
Beta
Size
Not measured
Who uses it
No live product imports it yet
import { KpiStat } from "@krizaka/charts/card";

Web only — React, from @krizaka/charts/card. Beta: its API may still change in a minor version.

  • Mobile · ✗ to build. A phone dashboard's head writes its figures by hand today. issue #275

Why it is here. Used by Sovkora.

When to use

  • The head of a dashboard: jobs, success rate, time to a result, spend.
  • Anywhere a figure needs its direction and its shape at a glance.

When not to use

  • A chart the reader will explore.Use instead: Line chart
  • A value against a limit.Use instead: Gauge

Installation

Install

npm install @krizaka/charts

Import

import { KpiStat } from "@krizaka/charts/card";

Examples

A dashboard row

Four figures in a StatGrid, with sparklines and trends.

One figure

A rise in latency is bad: good=down.

Props

A key figure, its change against the previous period and the shape of the period.

PropTypeDefaultDescription
labelrequiredstring—What the figure is (“Jobs”).
valuerequirednumber—The figure for the period.
brandBrandId—The brand whose palette the charts use. Without it, a chart follows a .brand-<id> ancestor, else Krizaka. Set it when the app loads a brand stylesheet on :root (@krizaka/tokens/brands/sovkora.css).
categoriesreadonly unknown[]—The labels of data (dates), for the sparkline's summary and table.
colorSeriesColor—The sparkline's colour. Default: the brand's.
datareadonly (number | null)[]—The shape of the period, oldest first (null for a gap). Without it, no sparkline.
formatValueFormat—How it is written. Default "number".
good"up" | "down"upWhich direction is good news. Default "up"; "down" for latency, failures, spend.
hintReactNode—A line under the value: the period, the comparison.
labelsChartLabelsInput—The words, translated: the buttons, the states, the written summary.
localeLocale—The locale of every figure and date ("fr-FR"). Default "en-US".
previousnumber—The same figure for the previous period: the trend is computed from it.
trendLabelReactNode—Your own words for the change instead of “+12 % vs previous period”.
variant"area" | "line" | "bar"areabar for discrete counts (jobs per day), area (default) or line.

Accessibility

  • The change is written (+24 % vs previous period), never colour or arrow alone.
  • The sparkline has its own accessible summary; the figure is read as text.

Best practices

  • Pass previous and the trend is computed and written in words; the arrow is only decoration.
  • Use good=down for latency, failures and spend: the arrow's colour says whether the change is good news.
  • Put several in a StatGrid of the kit: they wrap with the width.

Generated from the code of @krizaka/ui 5.3.4: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page