Back to Ant Design

Statistic

components/statistic/index.en-US.md

6.3.73.5 KB
Original Source

When To Use

  • When want to highlight some data.
  • When want to display statistic data with description.

Examples

<!-- prettier-ignore -->

<code src="./demo/basic.tsx">Basic</code> <code src="./demo/unit.tsx">Unit</code> <code src="./demo/animated.tsx">Animated number</code> <code src="./demo/card.tsx" background="grey">In Card</code> <code src="./demo/timer.tsx" version="5.25.0">Timer</code> <code src="./demo/style-class.tsx" version="6.0.0">Custom semantic dom styling</code> <code src="./demo/component-token.tsx" debug>Component Token</code>

API

Common props ref:Common props

Statistic

PropertyDescriptionTypeDefaultVersion
classNamesCustomize class for each semantic structure inside the Statistic component. Supports object or function.Record<SemanticDOM, string> | (info: { props }) => Record<SemanticDOM, string>-
decimalSeparatorThe decimal separatorstring.
formatterCustomize value display logic(value) => ReactNode-
groupSeparatorGroup separatorstring,
loadingLoading status of Statisticbooleanfalse4.8.0
precisionThe precision of input valuenumber-
prefixThe prefix node of valueReactNode-
stylesCustomize inline style for each semantic structure inside the Statistic component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props }) => Record<SemanticDOM, CSSProperties>-
suffixThe suffix node of valueReactNode-
titleDisplay titleReactNode-
valueDisplay valuestring | number-
valueStyleSet value section style, please use styles.content insteadCSSProperties-

Statistic.Countdown <Badge type="error">Deprecated</Badge>

<Antd component="Alert" title="When using version >= 5.25.0, Please use Statistic.Timer instead." type="warning" banner="true"></Antd>

<!-- prettier-ignore -->
PropertyDescriptionTypeDefaultVersion
formatFormat as dayjsstringHH:mm:ss
prefixThe prefix node of valueReactNode-
suffixThe suffix node of valueReactNode-
titleDisplay titleReactNode-
valueSet target countdown timenumber-
valueStyleSet value section styleCSSProperties-
onFinishTrigger when time's up() => void-
onChangeTrigger when time's changing(value: number) => void-4.16.0

Statistic.Timer <Badge>5.25.0+</Badge>

PropertyDescriptionTypeDefaultVersion
typetime counter down or upcountdown countup-
formatFormat as dayjsstringHH:mm:ss
prefixThe prefix node of valueReactNode-
suffixThe suffix node of valueReactNode-
titleDisplay titleReactNode-
valueSet target countdown timenumber-
valueStyleSet value section styleCSSProperties-
onFinishTrigger when time's up, only to be called when type is countdown() => void-
onChangeTrigger when time's changing(value: number) => void-

Semantic DOM

<code src="./demo/_semantic.tsx" simplify="true"></code>

Design Token

<ComponentTokenTable component="Statistic"></ComponentTokenTable>