Skip to main content

Slider

A draggable, token-driven slider built with PanResponder. Fully controlled via value and onChange, with an optional onSlidingComplete callback fired when the drag gesture ends.

Basic usage

Value: 40
function SliderDemo() {
const [value, setValue] = useState(40);

return (
<>
<Text variant="body">Value: {value}</Text>
<Slider value={value} onChange={setValue} min={0} max={100} step={1} />
</>
);
}

Custom range, step & colors

Rating: 5
<Slider
value={value}
onChange={setValue}
min={0}
max={10}
step={1}
fillColor="success"
thumbColor="success"
/>

Disabled

<Slider value={30} onChange={() => {}} isDisabled />

Props

PropTypeDefaultDescription
valuenumberRequired. Controlled value, between min and max.
onChange(value: number) => voidRequired. Called continuously while dragging.
onSlidingComplete(value: number) => voidCalled once when a drag gesture ends.
minnumber0Minimum value.
maxnumber100Maximum value.
stepnumber1Value increment snapped to while dragging.
isDisabledbooleanfalseDisables interaction and dims opacity.
trackHeightnumber4Track height in pixels.
thumbSizenumber20Thumb diameter in pixels.
trackColorTVajraColors'surfaceRaised'Track background color.
fillColorTVajraColors'primary'Filled portion color.
thumbColorTVajraColors'primary'Thumb color.
testIDstringTest identifier.