Rebar UI

1.1

imitation

Statistic

A labeled number for a summary row or a card headline.

This weekTitle, value, and optional prefix, suffix and precision
Open tasks
42
Due soon
7
Shipped
18
Hours logged
109h
Precision
On-time rate
87.5%
Prefix
Budget left
£158,450
No data
Interviews booked
—
Caption below (titlePlacement="bottom")
Mandatory Days attended this cycle
0/ 56
Long title
Tasks waiting on a client reply
7

In context

Dashboard headerOne card per figure, with a delta line under each
Open tasks
42

↓ 6 this week

Due soon
7

3 today

Shipped
18

↑ 4 vs last month

Props

PropTypeRequiredDefault
titleReactNodeNo—
valuestring | numberYes—
precisionnumber | undefinedNo—
prefixReactNodeNo—
suffixReactNodeNo—
titlePlacement"top" | "bottom" | undefinedNotop
classNamestring | undefinedNo—
bionicboolean | undefinedNo—
bionicOptionsBionicOptions | undefinedNo—

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.

PropertyDefault
--rebar-statistic-affix-colorinherit1.1
--rebar-statistic-affix-numericinherit1.1
--rebar-statistic-affix-sizevar(--rebar-font-size-md, 16px)1.1
--rebar-statistic-affix-trackinginherit1.1
--rebar-statistic-affix-weightvar(--rebar-font-weight-medium)1.1
--rebar-statistic-gapvar(--rebar-space-xs, 4px)1.1
--rebar-statistic-title-gapvar(--rebar-space-xs, 4px)1.1
--rebar-statistic-title-line-heightinherit1.1
--rebar-statistic-title-sizevar(--rebar-font-size-sm, 14px)1.1
--rebar-statistic-value-line-height1.051.1
--rebar-statistic-value-sizevar(--rebar-font-size-2xl, 32px)1.1
--rebar-statistic-value-tracking-0.02em1.1
--rebar-statistic-value-weightvar(--rebar-font-weight-semibold)1.1