QuantityStepper

QuantityStepper is an animated quantity stepper component for React Native and React, from the dissolve library. Minus and plus with rolling digits and an accelerating long press; at 1 it turns into a trash.

A minus and plus stepper with rolling digits. A tap steps once; hold a button and it repeats from 380 ms down to 60 ms over 1.5 s, the digits rolling like an odometer and always in sync. At the minimum the minus turns into a trash, armed once its morph is done so a fast double tap never removes the row; tap it and the whole row falls away as sand. At the maximum the pill shakes.

Install

React Native

Install the engine once per app and wrap the root layout in <DissolveProvider> (see Installation), then copy the component into components/dissolve:

npx expo install dissolve-ui @shopify/react-native-skia react-native-reanimated react-native-worklets react-native-gesture-handler expo-haptics
npx dissolve-ui add quantity-stepper --native
npx shadcn@latest add https://dissolve.rselmi.com/r/native/quantity-stepper.json

React

Needs React 19 and react-dom, nothing else: no engine, no provider, no Tailwind. Works in the Next.js App Router.

npx dissolve-ui add quantity-stepper --web
npx shadcn@latest add https://dissolve.rselmi.com/r/quantity-stepper.json

Usage

QuantityStepper.tsx (React Native)
import { QuantityStepper } from '@/components/dissolve/quantity-stepper';

const { ref, dissolving, dissolve } = useDissolve();

<View ref={ref} collapsable={false} style={{ opacity: dissolving ? 0 : 1 }}>
  <QuantityStepper
    value={qty}
    onChange={setQty}
    onRemove={async () => {
      await dissolve({ preset: 'sand' });
      removeFromCart(item.id);
    }}
  />
</View>
QuantityStepper.tsx (React)
import { QuantityStepper } from '@/components/dissolve/quantity-stepper';

<QuantityStepper
  value={qty}
  onChange={setQty}
  onRemove={() => removeFromCart(item.id)}
/>

Props

PropTypeDefaultDescription
valuenumberrequiredThe quantity. Digits roll whenever it changes.
onChange(value: number) => voidrequiredCalled on every step: once per tap (on release), then at 380 ms on hold, accelerating to 60 ms.
minnumber1Lowest value. With onRemove the minus turns into a trash there.
maxnumber99Highest value. Going past it shakes the pill.
onRemove() => voidWhen set, the minus becomes a trash at the minimum and calls this on tap (ignored for 320 ms after reaching it). Dissolve your row here.
size'sm' | 'md''md'Pill height, 30 or 36.
hapticsbooleantrueA tick per step, medium on remove, warning at max.
classNamestringPill classes (background, radius, margins...).
textClassNamestringCount classes (weight, color...).

Source

Previous: TaskCheck · Next: RulerPicker · All components

dissolve is MIT licensed. Source on GitHub, package on npm. This page as markdown. For AI agents: llms.txt.