Displays a labeled numeric value, such as a KPI or dashboard metric.
Import
import { Statistic } from "@kobalte/core/statistic";// orimport { Root, Label, Value, Description, Trend } from "@kobalte/core/statistic";Features
- Auto-wires
aria-labelledby/aria-describedbyfromStatistic.Label/Statistic.DescriptionontoStatistic.Root. Statistic.Valueformats itsvaluefor the current locale viaIntl.NumberFormat, or accepts pre-formatted children directly for unitsIntl.NumberFormatcan't express.Statistic.Valueis apolitelive region, so value changes (e.g. a real-time metric refreshing) are announced to screen reader users without moving focus.Statistic.Trendgenerates its own accessible sentence (e.g. "increased by 2.5%") from a signedvalue— the meaning never depends on an arrow's color or shape alone.
Anatomy
The statistic consists of:
- Statistic: Contains all the parts of a statistic.
- Statistic.Label: An accessible label describing the statistic.
- Statistic.Value: The statistic's value.
- Statistic.Description: Optional supplementary text (e.g. a breakdown).
- Statistic.Trend: Indicates the direction and magnitude of change.
<Statistic> <Statistic.Label /> <Statistic.Value /> <Statistic.Description /> <Statistic.Trend /></Statistic>Example
export function BasicExample() { return ( <Statistic> <Statistic.Label class={style.label}>Web traffic</Statistic.Label> <Statistic.Value class={style.value} value={255650} formatOptions={{ notation: "compact" }} /> </Statistic> );}.label { display: block; font-size: 12px; color: hsl(240 4% 46%); margin-bottom: 2px;}
.value { display: block; font-size: 28px; font-weight: 600; color: hsl(240 6% 20%);}
.description { display: block; font-size: 12px; color: hsl(240 4% 60%); margin-top: 2px;}
.trend--increase,.trend--decrease { margin-left: 8px; display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 500;}
.trend--increase { color: hsl(142 71% 35%);}
.trend--decrease { color: hsl(0 72% 51%);}
.row { display: flex; align-items: flex-start; gap: 16px;}
.button { border-radius: 6px; border: 1px solid hsl(240 5% 84%); background-color: white; padding: 6px 12px; font-size: 13px; color: hsl(240 6% 20%); cursor: pointer;}
.button:hover { background-color: hsl(240 5% 96%);}
[data-kb-theme="dark"] .value { color: hsl(240 5% 96%);}
[data-kb-theme="dark"] .button { background-color: hsl(240 6% 10%); border-color: hsl(240 5% 20%); color: hsl(240 5% 96%);}Usage
With description
Statistic.Description adds supplementary text (e.g. a breakdown), wired
to Statistic.Root via aria-describedby.
import { Statistic } from "@kobalte/core/statistic";
function App() { return ( <Statistic> <Statistic.Label class="label">Security insights</Statistic.Label> <Statistic.Value class="value" value={40} /> <Statistic.Description class="description">12 high, 28 low</Statistic.Description> </Statistic> );}With trend
Statistic.Trend renders whatever visual you pass as children (an arrow
glyph, an icon, colored text — Kobalte has no opinion), marks it
aria-hidden, and separately generates its own accessible sentence from
the signed value prop.
import { Statistic } from "@kobalte/core/statistic";import "./style.css";
function App() { return ( <Statistic> <Statistic.Label class="label">Cache rate</Statistic.Label> <Statistic.Value class="value" value={0.162} formatOptions={{ style: "percent", maximumFractionDigits: 1 }} /> <Statistic.Trend value={-0.025} formatOptions={{ style: "percent", maximumFractionDigits: 1 }} class="trend--decrease" > ▼ 2.5% </Statistic.Trend> </Statistic> );}.trend--decrease { margin-left: 8px; color: hsl(0 72% 51%); font-weight: 500;}Live updating value
Statistic.Value renders aria-live="polite" aria-atomic="true" — when
value changes, screen readers announce the new value without moving
focus, which matters for dashboards where metrics refresh in the
background.
API Reference
Statistic
Statistic is equivalent to the Root import from @kobalte/core/statistic.
| Prop | Description |
|---|---|
| id | string A unique identifier for the component. The id is used to generate id attributes for nested components. If no id prop is provided, a generated id will be used. |
Statistic.Value
| Prop | Description |
|---|---|
| value | number The numeric value to display, formatted for the current locale. |
| formatOptions | Intl.NumberFormatOptions Options for formatting value. Defaults to {}. |
| children | JSX.Element Pass a pre-formatted value directly instead — takes precedence over value/formatOptions. |
Statistic.Value's id is wired to Statistic's aria-labelledby when used in place of Statistic.Label.
Statistic.Trend
| Prop | Description |
|---|---|
| value | number The signed change represented by the trend, e.g. 0.025 for a 2.5% increase or -0.025 for a 2.5% decrease. Drives data-direction and the accessible text. |
| formatOptions | Intl.NumberFormatOptions Options for formatting the absolute value of value. Defaults to { style: "percent" }. |
| translations | StatisticIntlTranslations Localization strings. |
| children | JSX.Element The visual representation of the trend (e.g. an arrow + formatted value). Rendered with aria-hidden="true". |
| Data attribute | Description |
|---|---|
| data-direction='increase' | Present when value is positive. |
| data-direction='decrease' | Present when value is negative. |
| data-direction='noChange' | Present when value is 0. |
Rendered elements
| Component | Default rendered element |
|---|---|
Statistic | div |
Statistic.Label | span |
Statistic.Value | div |
Statistic.Description | span |
Statistic.Trend | div |
Last updated: 11/28/26, 9:28 PM