RulerPicker
RulerPicker is an animated ruler picker component for React Native and React, from the dissolve library. Horizontal ruler with momentum, rolling value and a haptic tick per graduation.
A horizontal ruler you drag under a center needle: 1:1 pan, momentum, then a calm snap on the nearest step. The value rolls above it. Graduations near the needle stretch with speed, and a haptic tick lands on every step.
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-hapticsnpx dissolve-ui add ruler-picker --nativenpx shadcn@latest add https://dissolve.rselmi.com/r/native/ruler-picker.jsonReact
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 ruler-picker --webnpx shadcn@latest add https://dissolve.rselmi.com/r/ruler-picker.jsonUsage
import { RulerPicker } from '@/components/dissolve/ruler-picker';
<RulerPicker
value={kg}
onChange={setKg}
min={30}
max={200}
step={0.1}
unit="kg"
/>import { RulerPicker } from '@/components/dissolve/ruler-picker';
<RulerPicker
value={kg}
onChange={setKg}
min={30}
max={200}
step={0.1}
unit="kg"
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | required | Current value. An outside change glides the ruler to it. |
onChange | (value: number) => void | Called once the ruler is at rest on a new value. | |
onChanging | (value: number) => void | Called on every step crossed while dragging or gliding. | |
min / max | number | required | Bounds. Past them the ruler follows with a 0.3 rubber band. |
step | number | 1 | Value between two graduations. |
majorEvery | number | 10 | A labelled major graduation every N steps. |
unit | string | Unit next to the value, e.g. 'kg'. | |
format | (value: number) => string | Formats the labels and the accessibility value. | |
tickSpacing | number | 10 | Distance between two graduations, pt. |
height | number | 76 | Ruler height. |
showValue | boolean | true | Shows the rolling value above the ruler. |
fontSize | number | 56 | Value size. |
haptics | boolean | true | A tick per step, light on majors, rigid at the bounds. |
className | string | Root classes (margins, width...). | |
valueClassName | string | Value classes, passed to NumberTicker. |
Source
- React Native: registry/ruler-picker.tsx
- React: registry/web/ruler-picker.tsx and registry/web/ruler-picker.core.ts
Previous: QuantityStepper · Next: BarChart · All components
dissolve is MIT licensed. Source on GitHub, package on npm. This page as markdown. For AI agents: llms.txt.