Skip to content
Native Animation
Base Sliding Number animation previewBase Sliding Number animation preview

This preview uses fictional demo content. See the props below for the customization options available in this component.

npx nativeanimation add base-sliding-number

Base Sliding Number

React Native Sliding Number Component

A rolling number display with independent digit springs and configurable value, formatting, font, and color.

Native Animation Base · Free · MIT

Add to your project

Copy the component and its assets into your app with the Native Animation CLI, or paste the agent prompt into Claude Code, Codex or Cursor once the MCP server is connected.

About this component

Related guides

A rolling number display with independent digit springs and configurable value, formatting, font, and color.

How it works

  1. The value is formatted with Intl.NumberFormat, so currency, percent, grouping and fixed digits all work.
  2. Every digit is a 0–9 wheel clipped to one line; it springs to its digit (stiffness 200, damping 20, mass 0.4).
  3. Digits are keyed from the right, so units stay units when the number gains a digit.
  4. Tabular figures keep the width steady while digits roll.

Install

npx nativeanimation add base-sliding-number

The CLI also copies base-theme. Dependencies, if you copy by hand:

npx expo install react-native-reanimated react-native-worklets

Usage

import { BaseSlidingNumber } from './base-sliding-number';

<BaseSlidingNumber value={followers} fontSize={40} />

Currency and a two-digit timer:

<BaseSlidingNumber value={total} format={{ style: 'currency', currency: 'USD' }} fontSize={24} />
<BaseSlidingNumber value={seconds} format={{ minimumIntegerDigits: 2 }} />

Wrap your app in BaseThemeProvider (from base-theme) to choose light/dark and an accent; without it, pieces use the light neutral theme. Every piece also takes a theme prop that wins over the provider.

Props

PropTypeDefaultDescription
valuenumber—The number to show.
formatIntl.NumberFormatOptions—Formatting (currency, digits…).
localestring'en-US'Locale for formatting.
fontSize / lineHeightnumber24 / 1.25×Type size and the height of each wheel.
color / fontFamilystringthemeText color and font.
themeBaseThemeproviderOverrides the theme from BaseThemeProvider.
testIDstring—Test identifier on the root view.

Compatibility

Expo SDK 58 · React Native 0.88 · Reanimated 4.7 · react-native-worklets 0.13. Runs on iOS, Android and web, in Expo Go and in development builds. Part of Native Animation Base, a free family that shares one theme: install base-theme once (the CLI does it for you) and every Base piece picks it up.

Accessibility

Screen readers read the formatted value as one label, not digit by digit. With Reduce Motion on, digits change without rolling.

Source code

Loading public source…