Kinetik UI

Range Slider

.md

A two-ended slider for a range: the nearer end follows the finger with a value bubble, over an optional histogram.

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

Installation

Kinetik CLI
npx kinetik-ui add range-slider

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/range-slider.json

Install manually

  1. Install dependencies
    npx expo install react-native-gesture-handler react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/range-slider.tsx
    View source files

Usage

import { RangeSlider } from '@/components/kinetik/range-slider';

const [price, setPrice] = useState<[number, number]>([120, 380]);

<RangeSlider
  label="Per night"
  value={price}
  onValueChange={setPrice}
  max={600}
  step={10}
  minDistance={50}
  formatValue={(v) => `$${v}`}
  histogram={bands}
/>;

histogram takes one number per band across the range, such as how many results fall in each price band. Bars inside the range light up as it changes.

When to use

  • Filtering by a range: price, distance, duration, year built.
  • Ranges where seeing the spread of results helps people choose, with histogram.

When not to use

  • A single value. Use Elastic Slider.
  • Ranges people know exactly and want to type. Pair two number fields instead.

Notes

  • Touch anywhere on the track: the nearer end jumps there and follows the finger. When the ends meet, the one in the direction of the drag moves.
  • minDistance keeps the ends apart (one step by default). Screen reader actions respect it too.
  • onValueChange fires on each step while dragging and onSlidingComplete once on release, so you can filter live or only when the finger lifts.
  • With reduced motion, values set from outside jump into place and the held end does not swell.

Props

RangeSliderProps

PropTypeDefaultDescription
valuerequiredRangeValue—
labelrequiredstring—Names the slider, e.g. "Price per night". Shown above the track.
onValueChange(value: [number, number]) => void—Called as either end changes while dragging.
onSlidingComplete(value: [number, number]) => void—Called once when the finger lifts.
minnumber0Defaults to 0.
maxnumber100Defaults to 100.
stepnumber1Defaults to 1.
minDistancenumber—The closest the two ends may come, in value units. Defaults to one step.
endLabelsreadonly [string, string]['Minimum', 'Maximum']Names the two ends for screen readers. Defaults to Minimum and Maximum.
formatValue(value: number) => string(v) => String(v)Formats values for the readout, the bubble and screen readers.
histogramreadonly number[]—Bars drawn behind the track, e.g. how many results fall in each price band.
hapticsbooleantrueHaptic ticks on each step when steps are coarse. Defaults to true.
disabledbooleanfalse
testIDstring—
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
Thumbs and fill move on the UI thread. The readout and histogram re-render once per step while dragging; nothing runs at rest.
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 · 142 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
The ends jump to new values set from outside, and the thumbs do not swell; dragging still follows the finger.
Screen readers
Two adjustable elements ("Price, Minimum" and "Price, Maximum") with increment and decrement actions that never cross.
Touch target
The whole 44 pt track takes the drag and the nearer end follows. Each thumb's slop makes it 44 pt.

Source files

components/kinetik/range-slider.tsx is in the Code tab of the preview above.