Skip to main content
  1. Docs
  2. Components
  3. Data display

Stat

A key number with its label, a note and a small trend. Several sit in a StatGroup's ruled strip.

Import
@qeetrix/react/experimental
Status
ExperimentalSince 0.0.4
Renders
<dl>Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Import

stat.tsx
// Experimental: from the package's experimental entry, until it's stable.
import { Stat, StatGroup } from "@qeetrix/react/experimental";

02

Props

And every native attribute of the element it renders.

PropTypeDefaultWhat it does
labelReactNoderequiredWhat's counted: "Total users".
valueReactNoderequiredA number is formatted for locale, as money with currency; pass a string for units and percentages.
currencystring—An ISO code, "INR": money, a whole amount with no fraction.
formatIntl.NumberFormatOptions—Over the defaults, for a numeric value.
noteReactNode—One line under the value.
tone"neutral" | "positive" | "negative" | "warning""neutral"Colours the note.
trendnumber[]—Recent values, oldest first, drawn as a small line: decorative.
chartReactNode—A small chart under the note, in a summary band: a Meter, a ShareBar.
actionReactNode—A link at the cell's foot, into the list it counts.
loadingbooleanfalsePlaceholders for the value and note; Loading is read instead.
locale · messagesstring · objectthe provider'sFormats a numeric value; the Loading string.
StatGroup: childrenStat[]—Side by side in equal ruled cells, at least 200px wide.

03

Parts

Each part carries a data-slot, for tests and placement.

data-slotElementWhat it is
stat-group<dl>The strip.
stat<div>One stat: aria-busy while loading.
stat-label<dt>The term.
stat-value<dd>The number.
stat-trend<svg>aria-hidden.
stat-note<dd>data-tone.

04

A figure that isn't money

format: Intl.NumberFormat options for a numeric value, such as a percentage.

adoption.tsx
<Stat label="Passkey adoption" value={0.72} format={{ style: "percent" }} />
Next — StatAccessibility