Weight picker
A bathroom-scale dial you turn under a fixed needle to set a weight, with a large rolling value, a kilograms or pounds switch and a straight tape shape for tight rows.
npx @swipeui/cli add weight-pickerWhen to use it
- Asking for a body weight in onboarding, a health profile or a daily weigh-in.
- Any weight a person reads off a scale faster than they type it.
When not to use it
- A count or a quantity: use Number field or Stepper.
- A height or a length: use Height picker.
Installation
Installs with a Pro licence
Everything on this page is public except the source. Founder pre-sale opens around 5 January 2027.
Usage
import { WeightPicker } from '@/components/swipeui/special/weight-picker';
<WeightPicker defaultValue={72.4} onValueCommit={(kg) => saveWeight(kg)} />;The value is always kilograms. The unit switch changes what is shown, never what is stored, so switching back and forth can't drift.
Examples
- Onboarding: the dial with the value inside it and the unit switch below.
- Units: start in pounds with
defaultUnit="lb". - Log:
shape="flat"puts a straight tape in a card, with the value and the switch above it.
Weight picker settings
| Prop | Does | Default |
|---|---|---|
| value, defaultValue | The weight in kilograms | 70 |
| onValueChange | Every new step while the dial moves | — |
| onValueCommit | Once, when the dial settles | — |
| unit, defaultUnit | kg or lb | kg |
| onUnitChange | The switch was used | — |
| unitSwitch | Show the unit switch | true |
| min, max | The range in kilograms | 30, 200 |
| precision | The step in the unit shown: 0.1, 0.5 or 1 | 0.1 |
| shape | arc (a dial) or flat (a tape) | arc |
| needle | Show the needle | true |
| wobble | Swing the needle once as the dial lands | true |
| dialSpan | Degrees of the rim shown, 40 to 160 | 100 |
| fill | Accent ticks below the value | true |
| readout | The large rolling value | true |
| momentum | Carry on after a flick and land on a step | true |
| rubberBand | Stretch past the ends | true |
| fineScrub | Slow down by moving the finger down or up | true |
| tickSpacing | Points between ticks along the rim | 8 (10 with whole units) |
| formatValue | Replaces the readout text | — |
| label | The spoken name | Weight |
| locale | The locale for the digits | Device |
| disabled | Show without changing | false |
| haptics | A switch, or { tick, major, limit, unit, land } | true |
| messages | Built-in strings | English |
| motion | Local motion feel | App feel |
Composition and behavior
Drag the dial sideways and the value under the needle changes, with a tick on each step and a light tap at every major tick. A flick carries on and lands on a step; as it lands the needle swings once and a soft tap lands with it. Past the lightest and heaviest weights the dial stretches, then springs back. While dragging, move your finger down or up to slow the dial to half, quarter and eighth speed.
Screen readers get one adjustable element named Weight, with a value such as "72.4 kilograms" or "159.6 pounds"; swipe up or down to step. With Reduce Motion the dial still follows the finger and then lands at once, without the swing.
The dial pans sideways, so it can sit on a screen that scrolls vertically; wrap the app in GestureHandlerRootView. The dial keeps its left and right in right-to-left layouts, while the flat tape reverses. Only the ticks near the value are mounted, so tenths cost the same as whole units. The public demonstration is written separately for the browser.
Behavior and gestures
- Drag the dial sideways: the value under the needle changes with a tick per step and a tap at every major tick.
- Flick it and it carries on, then lands on a step; the needle swings once and a soft tap lands with it. The ends stretch and spring back.
- Move the finger down or up while dragging to slow the dial to half, quarter and eighth speed.
- The switch shows kilograms or pounds. The stored weight is always kilograms, so switching never changes it.
Accessibility
- The dial is one adjustable element named Weight, with a spoken value such as 72.4 kilograms or 159.6 pounds; swipe up and down to step.
- The ticks, the needle and the large readout are hidden from screen readers; fine-scrub rate changes are announced.
- The unit switch is a named group of two tabs.
Motion
- Uses the
drag,numberandselectmotion roles, so it follows your app's feel. Passmotionto tune this one instance. - The dial follows the finger and glides to a projected step on the drag role, with overshoot clamped; the needle swings out and back on the same role.
- The readout rolls on the number role; the unit switch's highlight glides on the select role.
- Reduce Motion: the dial still follows the finger, then lands at once with no needle swing; the landing tap stays.
Performance
- Only the ticks near the value are mounted, so tenths from 30 to 200 kilograms cost the same as whole units.
- The dial turns on the UI thread with one rotation; React hears about a new value once per step.
Notes for AI
- value, min and max are always kilograms. Use onValueCommit to save and onValueChange for live previews.
- Wrap the screen in GestureHandlerRootView. The dial pans sideways, so it can sit on a vertically scrolling screen.
- precision is 0.1, 0.5 or 1 in the unit shown. shape="flat" fits a form row.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.