explaingit

daformat/react-number-flow-input

Analysis updated 2026-06-24

12TypeScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

Single React component that turns a number input into an animated field with rolling digits, locale formatting, and a hidden native input for form submission.

Mindmap

mindmap
  root((NumberFlowInput))
    Inputs
      value prop
      defaultValue
      locale formatting options
      isAllowed validator
    Outputs
      Animated digit display
      Hidden native input value
      Form submission data
    Use Cases
      Animated currency fields
      Quantity selectors
      Percentage inputs
      Locale aware forms
    Tech Stack
      React
      TypeScript
      Intl NumberFormat
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Drop an animated currency input into a checkout form that submits with the rest of the fields

USE CASE 2

Show a quantity picker where each digit rolls when the user types or steps the value

USE CASE 3

Render locale-aware number inputs that format as 1,234,567 or 1.234.567 based on locale

USE CASE 4

Reject values outside a custom range by passing an isAllowed function

What is it built with?

ReactTypeScriptnpm

How does it compare?

daformat/react-number-flow-inputalamops/agetoraza-ali/blendpixel.com
Stars121212
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasyhardeasy
Complexity2/54/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Just install from npm or another package manager and drop the component in, no separate CSS import is needed.

In plain English

This is a small React component that turns an ordinary number input field into an animated one. As you type, each digit slides into place. If you select a digit and replace it, the new digit rolls past the old one like the wheels on a fruit machine. If the number is changed from outside, for example by code that updates the state, every digit rolls together to the new value. The visual style is modelled on a popular library called NumberFlow, but this version is a single React component with zero runtime dependencies beyond React 18 or newer. Inside the component there are actually two fields layered together. One is a contenteditable element that shows the animated digits to the user, and the other is a hidden native input element that holds the plain number. The hidden input is what HTML forms see, so the component can carry name, required, min, max, minLength, and maxLength attributes and submit naturally inside a normal form tag. The component handles many small details that come up in real number-entry fields. It can be controlled by passing a value prop or left uncontrolled with a defaultValue. It supports locale-aware formatting through the browser's built-in Intl.NumberFormat, so 1234567 can render as 1,234,567 in English or 1.234.567 in German. It clamps the number of digits after the decimal point, blocks the decimal key entirely when decimalScale is zero, allows negative numbers when asked, can add a leading zero to values like .5, and lets you supply an isAllowed function to reject any value you do not want. Usage is straightforward. After installing the package from npm, yarn, pnpm, bun, or deno, you import NumberFlowInput and drop it into your JSX with the props you need. Animations come built in, with a small style tag injected into the document head on first mount and no separate CSS import required. The package ships TypeScript types and over 220 unit and integration tests.

Copy-paste prompts

Prompt 1
Add NumberFlowInput to a React 18 form with name, required, and min and max attributes that submit natively
Prompt 2
Configure NumberFlowInput with locale en-DE, decimalScale 2, and an isAllowed function that blocks values above 10000
Prompt 3
Style the animated digits of NumberFlowInput using only Tailwind classes on the wrapping element
Prompt 4
Show how to control NumberFlowInput with a useState value prop and reset it on a button click

Frequently asked questions

What is react-number-flow-input?

Single React component that turns a number input into an animated field with rolling digits, locale formatting, and a hidden native input for form submission.

What language is react-number-flow-input written in?

Mainly TypeScript. The stack also includes React, TypeScript, npm.

How hard is react-number-flow-input to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is react-number-flow-input for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.