Kinetik UI

Roll Stepper

.md

A number stepper whose figure rolls up or down with each step, speeds up while held and bumps at its limits.

v1.0.0Live on webreact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add roll-stepper

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/roll-stepper.json

Install manually

  1. Install dependencies
    npx expo install react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/roll-stepper.tsx
    View source files

Usage

import { RollStepper } from '@/components/kinetik/roll-stepper';

<RollStepper label="Guests" value={guests} onValueChange={setGuests} min={1} max={6} />;

formatValue changes what is shown and read aloud, for example (v) => `${v} kg` . The window is sized to the widest of the minimum, the maximum and the current value, so the buttons stay put.

When to use

  • Small counts changed a step at a time: guests, nights, quantities in a cart, sets and reps.
  • Values where the exact number matters more than speed of entry.

When not to use

  • Large ranges or rough values. Use a slider, such as Elastic Slider.
  • Numbers people already know and want to type, such as an amount of money. Use a text field.

Notes

  • Holding a button repeats after a short pause and speeds up to about twenty steps a second. Turn it off with repeat={false}.
  • At a limit the button dims and the figure bumps against the end, with a heavier haptic.
  • Fractional steps are rounded to six places, so 0.1 + 0.2 lands on 0.3.
  • With reduced motion the figure changes in place.

Props

RollStepperProps

PropTypeDefaultDescription
valuerequirednumber—
onValueChangerequired(value: number) => void—
labelrequiredstring—Names the stepper for screen readers, e.g. "Guests".
minnumber0Defaults to 0.
maxnumber99Defaults to 99.
stepnumber1Defaults to 1.
formatValue(value: number) => string(v) => String(v)Formats the value, e.g. `(v) => \`${v} nights\``.
repeatbooleantrueKeep stepping while a button is held, faster the longer it is held. Defaults to true.
hapticsbooleantrueA tick on each step and a bump at the limits. Defaults to true.
disabledbooleanfalse
testIDstring—
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
Two text views and one shared value per roll. Holding a button re-renders once per step, down to one step every 45 ms.
Measured

Pixel 9 emulator, API 35, release build · interaction median 0.85× the system Settings app on the same emulator (indicative only) · no frames drawn at rest · 166 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
The figure changes in place, without the roll or the bump at the limits.
Screen readers
An adjustable value named by label, with increment and decrement actions, plus two buttons (Increase and Decrease) that report when a limit is reached.
Touch target
Both buttons are 44 pt circles.

Source files

components/kinetik/roll-stepper.tsx is in the Code tab of the preview above.