Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Collections

  • QuestionCard
  • Table
  • Book3D
  • ProTable
  • PricingTable
  • JsonViewer
  • EditableTable
  • List
  • Descriptions
  • RowActions
  • Tree
  • Card
  • Carousel
  • Video
  • Audio
  • BentoGrid
  • Image
  • MagicCard
  • AnimatedList
  • Marquee
  • Sortable
  • Kanban
  • DesignCanvas
  • LayerTree
  • StageDraw
  • SlideDeck
  • PresenterView
  • ComponentPicker
  • EventStream
  • QueueLane
  • DocumentSheet
  • Novel reader
  • Scheduler
  • Org classroom
  • Danmaku
  • LiveChat
  • LivePlayer
  • LogViewer
  • FileTree
  • CodeReviewThread
  • VirtualList
  • InfiniteScroll
  • LogoLoop
  • BounceCards
  • CardSwap
  • ChromaGrid
  • CircularGallery
  • DomeGallery
  • FlyingPosters
  • InfiniteMenu
  • MagicBento
  • ScrollStack
  • ProfileCard
  • TiltedCard
  • PixelCard
  • DecayCard
  • ReflectiveCard
  • Folder

Charts and Diagrams

  • Flow
  • Diagram
  • Paper
  • SequenceDiagram
  • Sankey
  • Sparkline
  • Funnel
  • Treemap
  • Gantt
  • Heatmap
  • ContributionGraph
  • Legend
  • Chart
  • WorldMap

Information

  • ImageViewer
  • LiveProductCard
  • DiffStat
  • ScoreRing
  • ScoreScale
  • Badge
  • Dot
  • StatusDot
  • Chip
  • FilterChip
  • Coupon
  • Tag
  • Annotation
  • Avatar
  • AvatarCircles
  • User
  • QRCode
  • Comment
  • RelativeTime
  • GitCommit
  • DeployStatus
  • ShieldBadge
  • AwardBadge
  • CreditCard
  • IconTile

Metrics

  • Stat
  • Statistic
  • Meter
  • Timeline
  • NumberTicker

Placeholders

  • Empty
  • Skeleton
  • Watermark

Statistic

statistic

Formats numeric values with precision, separators, prefixes, suffixes, optional animation, or a countdown.

Usage

Basic usage

number is formatted to thousandths, and string is output as is.

Active User
112,893
tsx
<Statistic title="Active User" value={112893} />

Precision and suffix

precision controls the decimal place, and prefix/suffix connects to the currency symbol or unit.

Account balance
¥89,234.56
Conversion rate
68.4%
tsx
<>
  <Statistic title="Account Balance" value={89234.56} precision={2} prefix="¥" />
  <Statistic title="Conversion rate" value={68.4} precision={1} suffix="%" />
</>

Admission rolling

animate connects to NumberTicker to do numerical rolling entry (only valid for number).

Total Order
0
tsx
<Statistic title="Total Order" value={45219} animate />

Custom color

valueStyle covers the numerical row style and can express rising and falling colors.

Compared with yesterday
↑11.28%
tsx
<Statistic
  title="More than yesterday"
  value={11.28}
  precision={2}
  prefix="↑"
  suffix="%"
  valueStyle={{ color: "var(--color-success)" }}
/>

Countdown

Statistic.Countdown counts down to the deadline in real time; format controls the display template (supports D/H/m/s/S).

The event ends
00:00:00
tsx
<Statistic.Countdown title="The event ends" deadline={Date.now() + 1000 * 60 * 60} />

When to use

Use Statistic to format a single number or render a countdown through Statistic.Countdown. Stat is the complementary full KPI card with label, value, and comparison trend.

Import

ts
import { Statistic, formatStatistic, formatCountdown } from "@hulianui/ui"

Props

Statistic

NameTypeDefaultDescription
value*number | string-Numbers receive grouping and precision; strings render unchanged.
precisionnumber-Decimal places for numeric values.
groupSeparatorbooleantrueEnables thousands grouping.
animatebooleanfalseUses NumberTicker entrance animation for numbers; animated values always group.
valueStyleCSSProperties-Inline value color, size, or other styles.
align"start" | "center" | "end""start"Horizontal value alignment.
classNamestring-Custom class name.

Statistic.Countdown

NameTypeDefaultDescription
deadline*number-Millisecond deadline on the same basis as Date.now().
formatstring"HH:mm:ss"Template supporting D/H/HH/m/mm/s/ss/S/SS/SSS.
valueStyleCSSProperties-Inline value styles.
classNamestring-Custom class name.

Events

Statistic.Countdown

EventTypeDescription
onFinish() => voidFires once when the countdown reaches zero.

Slots

Statistic

SlotTypeDescription
titleReactNodeLabel above the value.
prefixReactNodeCurrency symbol, icon, or other prefix.
suffixReactNodeUnit or other suffix.

Statistic.Countdown

SlotTypeDescription
titleReactNodeCountdown title.
prefixReactNodeCountdown prefix.
suffixReactNodeCountdown suffix.

Pitfalls

  • Initialize countdown deadlines once with useState(() => Date.now() + ...); computing them during every render drifts and can cause hydration mismatches.
  • The value row is flex, so text-center on className does not align it; use align.
  • Precision and grouping affect numeric values only. Strings render verbatim.

Related

Stat · Chart · Meter · Timeline · NumberTicker · WorldMap

Playground

¥112,893
<Statistic value={112893} precision={0} prefix="¥" />
PreviousStatData DisplayNextChart

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Slots
    • Pitfalls
    • Related
  • Playground