MCPcopy Index your code
hub / github.com/almond-bongbong/react-slot-counter

github.com/almond-bongbong/react-slot-counter @v3.3.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.3.3 ↗ · + Follow
28 symbols 72 edges 16 files 0 documented · 0% updated 3mo agov3.3.3 · 2026-03-24★ 1743 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

React Slot Counter 🎰 - Make Your UI Count! ✨

🚀 Elevate Your UI with Dynamic, Eye-Catching Counters - React Slot Counter

Make Your Numbers Pop 🌟: Simple and Dynamic Counters for Your UI

NPM License Size NPM Downloads

Deploy to GitHub Pages

🚀 What's New in 3.0.0?

Key Changes

  • New Prop: speed: Adjust animation speed more intuitively with the new speed prop.
  • New Prop: delay: Each column's animation start can now be delayed using the delay prop.

<a target="_blank" href="https://almond-bongbong.github.io/react-slot-counter/">
    <img src="https://github.com/almond-bongbong/react-slot-counter/raw/main/docs/preview.gif" />
</a>

💡 Why React Slot Counter?

React Slot Counter is your go-to solution for adding animated, interactive counters to your web applications. With customizable animations, diverse input compatibility, and easy integration, it's designed to make your numbers not just visible but visually striking.

🌟 Key Features

  • Versatile Inputs: Beyond numbers—strings, JSX elements, and more.
  • Animation on Demand: Updates animate only the changed elements.
  • Sequential Animation: For that extra touch of order and purpose.
  • Total Customizability: Tailor the look and feel to fit your app perfectly.

📦 Quick Installation

npm install react-slot-counter

🛠 Easy Usage

Import SlotCounter and use it in your component. Here's a simple example:

import React from 'react';
import SlotCounter from 'react-slot-counter';

function App() {
  return (
    <>
      <SlotCounter value={123456} />
      <SlotCounter value={36.5} />
      <SlotCounter value="1,234,567" />
      <SlotCounter value={['1', '2', '3', '4', '5', '6']} />
      <SlotCounter value="??????" />
    </>
  );
}

export default App;

🎥 Live Demo

Explore more at the demo page.

📝 Comprehensive Props

Detailed props for customizing SlotCounter to fit your UI needs:

  • value (required): Display numbers, strings, or JSX elements.
  • duration: Control the speed of the animation.
  • animateUnchanged: Choose to animate all or only changed characters.
  • And many more!

See full props list

Prop Type Default Description
value (required) number | string | string[] | JSX.Element[] The value to be displayed. It can be a number or a string with numbers and commas.
startValue number | string | string[] | JSX.Element[] The initial value to be displayed before the animation starts. It sets the beginning of the slot machine animation.
startValueOnce boolean false If set to true, the animation starts from the startValue only for the first render. For subsequent animations, it starts from the last value.
duration number 0.7 The duration of the animation in seconds.
speed number 1.4 The speed of counter when running.
delay number The delay time for each column.
dummyCharacters string[] | JSX.Element[] Defaults to random numbers from 0 to 9 An array of dummy characters to be used in the animation.
dummyCharacterCount number 6 The number of dummy characters to be displayed in the animation before reaching the target character.
autoAnimationStart boolean true Determines whether the animation should start automatically when the component is first mounted.
animateUnchanged boolean false Determines whether to animate only the characters that have changed.
hasInfiniteList boolean false Determines whether the list should appear as continuous, with the end of the target character seamlessly connected to the beginning.
containerClassName string The class name of container.
charClassName string The class name of each character.
separatorClassName string The class name of the separator character (. or ,).
valueClassName string The class name for the value of the slot, making it possible to customize the styling and visibility of the value.
numberSlotClassName string The class name for the number slot, allowing you to customize the styling of the number slot.
numberClassName string The class name for the number, allowing you to customize the styling of the number.
sequentialAnimationMode boolean false Determines if the animation should increment or decrement sequentially from the startValue to value instead of random animation.
useMonospaceWidth boolean false Ensures that all numeric characters occupy the same horizontal space, just like they would in a monospace font.
direction 'bottom-up' | 'top-down' 'bottom-up' Sets the direction of the slot machine animation. Accepted values are 'bottom-up' and 'top-down'.
debounceDelay number 0 Specifies the delay in milliseconds for debouncing animations. When the value changes rapidly, it allows the animation to execute smoothly.
animateOnVisible boolean | rootMargin: string, triggerOnce: boolean false | rootMargin: '0px', triggerOnce: false

Extension points exported contracts — how you extend this code

Props (Interface)
(no doc)
example/src/components/CommonHighlighter.tsx
SlotCounterRef (Interface)
(no doc)
src/types/common.ts
Props (Interface)
(no doc)
src/components/Slot.tsx
AnimateOnVisibleOptions (Interface)
(no doc)
src/types/common.ts
SlotRef (Interface)
(no doc)
src/components/Slot.tsx
Props (Interface)
(no doc)
src/types/common.ts

Core symbols most depended-on inside this repo

mergeClassNames
called by 8
src/utils.ts
toNumeric
called by 5
src/utils.ts
isNumeric
called by 4
src/utils.ts
renderDummyList
called by 3
src/components/Slot.tsx
random
called by 2
example/src/App.tsx
range
called by 2
src/utils.ts
generateCyclicRange
called by 2
src/utils.ts
random
called by 2
src/utils.ts

Shape

Function 22
Interface 6

Languages

TypeScript100%

Modules by API surface

src/utils.ts11 symbols
src/components/Slot.tsx5 symbols
src/types/common.ts3 symbols
src/index.tsx2 symbols
example/src/components/CommonHighlighter.tsx2 symbols
example/src/App.tsx2 symbols
src/hooks/useValueChangeEffect.ts1 symbols
src/hooks/useDebounce.ts1 symbols
example/src/reportWebVitals.ts1 symbols

For agents

$ claude mcp add react-slot-counter \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page