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

NumberTicker

number-ticker

Animates a numeric value toward its target when it enters the viewport.

Usage

Basic usage

After entering the viewport, scroll from 0 to the target value, automatic thousandths.

0
tsx
<NumberTicker value={12345} className="text-4xl font-semibold" />

Decimal places

decimalPlaces Controls the number of decimal places, suitable for percentages/amounts.

0.0
tsx
<NumberTicker value={99.9} decimalPlaces={1} className="text-4xl font-semibold" />

Count down

When startValue is larger than value, it will naturally scroll downward without additional direction parameters.

100
tsx
<NumberTicker startValue={100} value={0} className="text-4xl font-semibold" />

Starting value and duration

startValue sets the starting point of scrolling, and duration lengthens the animation rhythm.

1,000
tsx
<NumberTicker startValue={1000} value={8888} duration={2.4} className="text-4xl font-semibold" />

When to use

Use NumberTicker to animate a KPI or dashboard number from a starting value to a target. It renders only the number; use Stat for a title, unit, and comparison, or Statistic for richer formatting.

Import

ts
import { NumberTicker, formatTicker } from "@hulianui/ui"

Props

Inherits every native span attribute except children.

NameTypeDefaultDescription
value*number-Target value reached after entering the viewport.
startValuenumber0Initial value; values above the target naturally count down.
decimalPlacesnumber0Fraction digits passed to Intl.NumberFormat.
durationnumber1.2Duration in seconds using motionEase.out.
delaynumber0Delay after entering the viewport, in seconds.

Pitfalls

  • IntersectionObserver and requestAnimationFrame drive the tween. Headless screenshots can capture the initial frame; use a real browser or reduced motion. See [[verify-sub-second-web-animation-via-headless-screenshot]].
  • With prefers-reduced-motion: reduce, the final value renders immediately.

Related

Stat · Statistic · Chart · Meter · Timeline · WorldMap

Playground

0
<NumberTicker value={1234} decimalPlaces={0} />
PreviousTimelineData DisplayNextWorldMap

On this page

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