Statistic
A labeled number for a summary row or a card headline.
In context
↓ 6 this week
3 today
↑ 4 vs last month
Props
| Prop | Type | Required | Default |
|---|---|---|---|
title | ReactNode | No | — |
value | string | number | Yes | — |
precision | number | undefined | No | — |
prefix | ReactNode | No | — |
suffix | ReactNode | No | — |
titlePlacement | "top" | "bottom" | undefined | No | top |
className | string | undefined | No | — |
bionic | boolean | undefined | No | — |
bionicOptions | BionicOptions | undefined | No | — |
Accessibility
Plain text content — no special ARIA needed. A number is formatted with locale-aware thousands separators (toLocaleString) unless precision is set, in which case it's shown as a fixed-decimal string instead.
data-rebar-* attributes
data-rebar-component="statistic", data-rebar-part="title" | "value" | "prefix" | "suffix".
Caption placement and type properties
titlePlacement="bottom" puts the title under the value. --rebar-statistic-title-size/-line-height/-gap, --rebar-statistic-value-size/-weight/-tracking/-line-height, --rebar-statistic-gap and --rebar-statistic-affix-size/-weight/-color/-tracking/-numeric set the type; each fallback is the previous value.
Migrating to Ant Design
AntD's Statistic has the same title/value/precision/prefix/suffix prop shape almost exactly — a close, mostly mechanical rename, not yet codemod-covered.
Tokens
Custom properties, set on the component or any ancestor. The default is what applies when one is unset. 13 of 13 were added in 1.1.0 and are marked.
| Property | Default | |
|---|---|---|
--rebar-statistic-affix-color | inherit | 1.1 |
--rebar-statistic-affix-numeric | inherit | 1.1 |
--rebar-statistic-affix-size | var(--rebar-font-size-md, 16px) | 1.1 |
--rebar-statistic-affix-tracking | inherit | 1.1 |
--rebar-statistic-affix-weight | var(--rebar-font-weight-medium) | 1.1 |
--rebar-statistic-gap | var(--rebar-space-xs, 4px) | 1.1 |
--rebar-statistic-title-gap | var(--rebar-space-xs, 4px) | 1.1 |
--rebar-statistic-title-line-height | inherit | 1.1 |
--rebar-statistic-title-size | var(--rebar-font-size-sm, 14px) | 1.1 |
--rebar-statistic-value-line-height | 1.05 | 1.1 |
--rebar-statistic-value-size | var(--rebar-font-size-2xl, 32px) | 1.1 |
--rebar-statistic-value-tracking | -0.02em | 1.1 |
--rebar-statistic-value-weight | var(--rebar-font-weight-semibold) | 1.1 |