Skip to main content

Slider

A control for selecting a value from a bounded linear range of values.

Example​

const sliderValue = useBinding(0);
<Slider value={sliderValue} range={[0, 10]} />
info

If you want the value to be an integer, you can either use the step prop (which doesn't animate smoothly), or round the value when you use it (which does animate smoothly).

const roundedVal = Math.round($sliderValue.value);

Props​

Slider inherits all View Modifiers as props.

propdescriptiontyperequireddefault
valueThe stepper valueBinding<number> \| numberyesundefined
stepThe increment/decrement amountnumberno1
rangeThe range of values [minNumber, maxNumber][number, number]no[0, 100]
onChangeFunction to execute when the slider value changes(v: number) => voidnoundefined