Statistic
A labeled number with thousands separators, fixed precision, prefix and suffix.
import { Statistic } from '@lobehub/ui/base-ui';Data Display
Basic
Loading preview
APIs
Statistic properties
classNames{ title?: string; value?: string; }formatter(value: number | string | undefined) => ReactNodeloadingbooleanDefaults to
false.precisionnumberprefixnull | string | number | bigint | false | true | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>refnull | (instance: HTMLDivElement | null) => void | (() => VoidOrUndefinedOnly) | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES] | RefObject<HTMLDivElement | null>Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).
styles{ title?: CSSProperties; value?: CSSProperties; }suffixnull | string | number | bigint | false | true | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>titlenull | string | number | bigint | false | true | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>valuestring | number
Also accepts all native HTML and ARIA attributes.
Numbers format through Intl.NumberFormat('en-US'): thousands separators always, precision fixes the decimal places. Strings render unchanged. formatter replaces the built-in formatting. loading swaps the value for a skeleton.
Migrating from antd Statistic
valueStyle→styles.value.groupSeparator,decimalSeparator,Statistic.CountdownandStatistic.Timerare not supported.
Helpful?