2019-01-09 20:38:09 +08:00
|
|
|
|
---
|
|
|
|
|
category: Components
|
2022-11-09 12:28:04 +08:00
|
|
|
|
group: Data Display
|
2019-01-09 20:38:09 +08:00
|
|
|
|
title: Statistic
|
2024-03-22 14:22:42 +08:00
|
|
|
|
description: Display statistic number.
|
2022-11-30 20:14:41 +08:00
|
|
|
|
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*YL7PRYNtH-4AAAAAAAAAAAAADrJ8AQ/original
|
2023-02-09 22:17:31 +08:00
|
|
|
|
coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*BPWDRbSYxJ4AAAAAAAAAAAAADrJ8AQ/original
|
2022-11-09 12:28:04 +08:00
|
|
|
|
demo:
|
|
|
|
|
cols: 2
|
2019-01-09 20:38:09 +08:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## When To Use
|
|
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
|
- When want to highlight some data.
|
|
|
|
|
- When want to display statistic data with description.
|
2019-01-09 20:38:09 +08:00
|
|
|
|
|
2022-11-09 12:28:04 +08:00
|
|
|
|
## Examples
|
|
|
|
|
|
2022-11-17 17:31:26 +08:00
|
|
|
|
<!-- prettier-ignore -->
|
2022-11-09 12:28:04 +08:00
|
|
|
|
<code src="./demo/basic.tsx">Basic</code>
|
|
|
|
|
<code src="./demo/unit.tsx">Unit</code>
|
2023-01-05 14:07:33 +08:00
|
|
|
|
<code src="./demo/animated.tsx">Animated number</code>
|
2023-01-05 15:30:59 +08:00
|
|
|
|
<code src="./demo/card.tsx" background="grey">In Card</code>
|
2022-11-09 12:28:04 +08:00
|
|
|
|
<code src="./demo/countdown.tsx">Countdown</code>
|
2023-05-09 19:24:50 +08:00
|
|
|
|
<code src="./demo/component-token.tsx" debug>Component Token</code>
|
2022-11-09 12:28:04 +08:00
|
|
|
|
|
2019-01-09 20:38:09 +08:00
|
|
|
|
## API
|
|
|
|
|
|
2023-08-08 18:27:48 +08:00
|
|
|
|
Common props ref:[Common props](/docs/react/common-props)
|
|
|
|
|
|
2019-01-09 20:38:09 +08:00
|
|
|
|
#### Statistic
|
|
|
|
|
|
2022-06-13 14:03:43 +08:00
|
|
|
|
| Property | Description | Type | Default | Version |
|
|
|
|
|
| ---------------- | ----------------------------- | -------------------- | ------- | ------- |
|
|
|
|
|
| decimalSeparator | The decimal separator | string | `.` | |
|
|
|
|
|
| formatter | Customize value display logic | (value) => ReactNode | - | |
|
|
|
|
|
| groupSeparator | Group separator | string | `,` | |
|
|
|
|
|
| loading | Loading status of Statistic | boolean | false | 4.8.0 |
|
|
|
|
|
| precision | The precision of input value | number | - | |
|
|
|
|
|
| prefix | The prefix node of value | ReactNode | - | |
|
|
|
|
|
| suffix | The suffix node of value | ReactNode | - | |
|
|
|
|
|
| title | Display title | ReactNode | - | |
|
|
|
|
|
| value | Display value | string \| number | - | |
|
2022-06-24 16:39:21 +08:00
|
|
|
|
| valueStyle | Set value section style | CSSProperties | - | |
|
2019-01-09 20:38:09 +08:00
|
|
|
|
|
|
|
|
|
#### Statistic.Countdown
|
|
|
|
|
|
2021-03-01 19:20:48 +08:00
|
|
|
|
| Property | Description | Type | Default | Version |
|
|
|
|
|
| --- | --- | --- | --- | --- |
|
2022-06-13 14:03:43 +08:00
|
|
|
|
| format | Format as [dayjs](https://day.js.org/) | string | `HH:mm:ss` | |
|
2021-03-01 19:20:48 +08:00
|
|
|
|
| prefix | The prefix node of value | ReactNode | - | |
|
|
|
|
|
| suffix | The suffix node of value | ReactNode | - | |
|
|
|
|
|
| title | Display title | ReactNode | - | |
|
2024-03-16 17:48:34 +08:00
|
|
|
|
| value | Set target countdown time | number | - | |
|
2022-06-24 16:39:21 +08:00
|
|
|
|
| valueStyle | Set value section style | CSSProperties | - | |
|
2021-03-01 19:20:48 +08:00
|
|
|
|
| onFinish | Trigger when time's up | () => void | - | |
|
2021-05-24 16:24:00 +08:00
|
|
|
|
| onChange | Trigger when time's changing | (value: number) => void | - | 4.16.0 |
|
2023-04-11 10:25:24 +08:00
|
|
|
|
|
|
|
|
|
## Design Token
|
|
|
|
|
|
|
|
|
|
<ComponentTokenTable component="Statistic"></ComponentTokenTable>
|