Join our Discord community
Interactive

Stars Scrolling Wheel

Animated stars scrolling wheel with number counter and completion effects. Perfect for React applications requiring achievement displays with Next.js integration and TypeScript support.

Loading component...

Installation

npx shadcn@latest add https://www.shadcn.io/registry/stars-scrolling-wheel.json
npx shadcn@latest add https://www.shadcn.io/registry/stars-scrolling-wheel.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/stars-scrolling-wheel.json
bunx shadcn@latest add https://www.shadcn.io/registry/stars-scrolling-wheel.json

Features

  • Animated number wheel with smooth spring physics scrolling through value ranges using Motion
  • Star completion effects with fill animation, glow effects, and particle bursts using Lucide React icons
  • In-view detection triggers animation when component enters viewport with configurable timing
  • Customizable increments with configurable step values and side item display counts
  • Gradient overlays with smooth fade effects for realistic wheel appearance
  • TypeScript support with complete interface definitions for all animation and styling props

Use Cases

This free open source React component works well for:

  • Achievement displays - Star ratings and milestone counters in Next.js applications
  • Progress indicators - Visual feedback for completion states using TypeScript and Tailwind CSS
  • Statistics dashboards - Animated counters for user metrics and performance data
  • Gamification elements - Reward systems and level progression displays

API Reference

StarsScrollingWheel

PropTypeDefaultDescription
starsnumberrequiredTarget number of stars to count towards
stepnumber100Increment value between each displayed number
itemHeightnumber48Height of each number item in pixels
sideItemsCountnumber2Number of items visible above and below center
transitionSpringOptions{ stiffness: 90, damping: 30 }Motion spring configuration for scrolling animation
inViewbooleanfalseOnly animate when component enters viewport
inViewMarginstring"0px"Margin for in-view detection trigger
inViewOncebooleantrueOnly trigger in-view animation once
delaynumber0Initial delay before animation starts in milliseconds
classNamestring-CSS classes for container styling

Animation Sequence

  • Number scrolling - Spring-animated vertical movement through value range
  • Star filling - Color transition from muted to yellow when completed
  • Completion effects - Radial glow, scale animation, and particle burst
  • Particle animation - Six particles radiating outward in circular pattern

Visual Components

  • Gradient masks - Top and bottom fade effects for realistic wheel appearance
  • Center highlight - Muted background bar emphasizing current value
  • Number formatting - Intl.NumberFormat for proper thousand separators
  • Star icon - Lucide React Star with fill animation on completion

Implementation Notes

  • Uses Motion's useTransform for smooth value interpolation
  • Completion detection triggers when value reaches 99% of target
  • Gradient overlays use z-index layering for proper visual hierarchy
  • Number range generation accommodates side items for smooth scrolling
  • Component forwards ref for advanced integration scenarios
  • All animations cleanup automatically on component unmount