JGuang

Statistic

Statistic · Arco Design

Preview
npm install @arco-design/web-react@2.66.18

Statistic

Display statistic number.

Install

npm install @arco-design/web-react@2.66.18

Import @arco-design/web-react/dist/css/arco.css at the entry and set the locale with ConfigProvider. React 19 projects must also import @arco-design/web-react/es/_util/react-19-adapter first, or imperative APIs such as Message and Modal cannot render.

Examples

  • Basic: Use Statistics when you need to highlight a certain number or group of numbers or display statistical data with descriptions.
  • Custom Style: This example shows the addition of prefix and suffix, and the style of displaying values can be customized.
  • Countdown: Countdown component. You can use now to correct the initialization time.
  • Animation: With Statistic, you can make some interesting effects. For example, the value slowly becomes larger, making the display of the value more visual. If you set countUp, the animation will be executed after the component is mounted. If you want to control the animation by yourself, you can also get the instance through ref and execute ins.countUp().
  • DateFormat: Time display. Use dayjs to format the time, format is the format of dayjs.
  • Loading: You can control whether to display the loading status through loading.

Examples come from the official Arco Design repository (MIT) at the commit published as npm 2.66.18. Some use online images or upload endpoints; network requests are disabled in previews.

API

Statistic

PropertyDescriptionTypeDefaultValueVersion
countUpWhether the value becomes larger dynamicallyboolean--
groupSeparatorWhether to display thousands separatorboolean--
loadingIs the number loadingboolean-2.20.0
countDurationDynamic time (ms)number2000-
countFromThe number that the value starts to increase dynamicallynumber0-
precisionThe precision of the valuenumber--
formatdayjs's formatstring--
renderFormatCustom render function. formattedValue represents the formatted value.(value: StatisticProps['value'], formattedValue: string) => ReactNode-2.36.0
extrahe extra content to be rendered under the valueReactNode--
prefixThe prefix elementstring | ReactNode--
suffixThe suffix elementstring | ReactNode--
titleThe titlestring | ReactNode--
classNameAdditional css classstring | string[]--
styleAdditional styleCSSProperties--
styleDecimalThe style of the decimal part of the valueCSSProperties-2.47.0
styleValueThe css style of statistic's valueCSSProperties--
valueDisplay valuestring | number | Dayjs--

Statistic.Countdown

PropertyDescriptionTypeDefaultValueVersion
startWhether to start the countdownbooleantrue-
formatdayjs's formatstringHH:mm:ss-
titleThe title elementstring | ReactNode--
classNameAdditional css classstring | string[]--
nowThe current time. Used to correct the initialization timenumber | string | Date | Dayjs--
styleAdditional styleCSSProperties--
styleValueThe css style of statistic's valueCSSProperties--
valueTo set valuenumber | string | Date | Dayjs--
onFinishCallback at the end of the countdown() => void--
renderFormatCustom render function, the input parameter is the result formatted by dayjs(valueDiff: number, formattedDiff: string) => ReactNode-2.36.0