SwipeUI

Height picker

A ruler you scroll under a fixed pointer to set a height, with an accent fill, a large rolling value and a centimetres or feet and inches switch.

npx @swipeui/cli add height-picker
Variant
Preset
Material
Scheme
Feel
Interactive web demo. Native materials, gestures and system presentation differ on device.

When to use it

  • Asking for a height in onboarding, a health profile or a fitness goal.
  • Any length a person finds on a ruler faster than they type it.

When not to use it

  • A value with no natural scale, such as a quantity: use Number field or Stepper.
  • A percentage or a volume: use Slider.

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 { HeightPicker } from '@/components/swipeui/special/height-picker';

<HeightPicker defaultValue={172} onValueCommit={(cm) => saveHeight(cm)} />;

The value is always centimetres. The unit switch changes what is shown, never what is stored, so switching back and forth can't drift.

Examples

  • Onboarding: a tall ruler with the value beside it and the unit switch below.
  • Units: start in feet and inches with defaultUnit="ft"; feet step by one inch.
  • Compact: orientation="horizontal" puts a wide ruler in a form row, with precision={0.1} for tenths.

Height picker settings

PropDoesDefault
value, defaultValueThe height in centimetres170
onValueChangeEvery new step while the ruler moves—
onValueCommitOnce, when the ruler settles—
unit, defaultUnitcm or ftcm
onUnitChangeThe switch was used—
unitSwitchShow the unit switchtrue
min, maxThe range in centimetres100, 220
precisionThe centimetre step, 1 or 0.11
fillAccent ticks below the valuetrue
readoutThe large rolling valuetrue
momentumCarry on after a flick and land on a steptrue
rubberBandStretch past the endstrue
fineScrubSlow down by moving across the rulertrue
orientationvertical or horizontalvertical
lengthA vertical ruler's height in points320
tickSpacingPoints between ticks10 (6 with tenths)
formatValueReplaces the readout text—
labelThe spoken nameHeight
localeThe locale for the digitsDevice
disabledShow without changingfalse
hapticsA switch, or { tick, major, limit, unit }true
messagesBuilt-in stringsEnglish
motionLocal motion feelApp feel

Composition and behavior

Drag the ruler and the value under the pointer changes, with a tick on each step and a light tap at every ten centimetres or every foot. A flick carries on and lands on a step. Past the shortest and tallest heights the ruler stretches, then springs back. While dragging, move your finger across the ruler to slow it to half, quarter and eighth speed.

Screen readers get one adjustable element named Height, with a value such as "172 centimetres" or "5 feet 8 inches"; swipe up or down to step. With Reduce Motion the ruler still follows the finger and then lands at once.

Put the vertical ruler on a screen that doesn't scroll under it, and wrap the app in GestureHandlerRootView. Only the ticks near the value are mounted, so tenths cost the same as whole centimetres. The public demonstration is written separately for the browser.

Behavior and gestures

  • Drag the ruler: the value under the pointer changes with a tick per step and a tap at every ten centimetres or every foot.
  • Flick it and it carries on, then lands on a step. The ends stretch and spring back.
  • Move the finger across the ruler while dragging to slow it to half, quarter and eighth speed.
  • The switch shows centimetres or feet and inches. The stored height is always centimetres, so switching never changes it.

Accessibility

  • The ruler is one adjustable element named Height, with a spoken value such as 172 centimetres or 5 feet 8 inches; swipe up and down to step.
  • The ticks 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, number and select motion roles, so it follows your app's feel. Pass motion to tune this one instance.
  • The ruler follows the finger and glides to a projected step on the drag role, with overshoot clamped.
  • The readout rolls on the number role; the unit switch's highlight glides on the select role.
  • Reduce Motion: the ruler still follows the finger, then lands at once; the readout swaps.

Performance

  • Only the ticks near the value are mounted, so tenths over a 120cm range cost the same as whole centimetres.
  • The ruler moves on the UI thread; React hears about a new value once per step.

Notes for AI

  • value, min and max are always centimetres. Use onValueCommit to save and onValueChange for live previews.
  • Wrap the screen in GestureHandlerRootView. Put the vertical ruler on a screen that does not scroll under it.
  • precision is 1 or 0.1 centimetres; feet always step by one inch.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items