Slider
Pre-alphaThe registry and the CLI are not published yet.Roadmap

Slider

Pick a single value or a range by dragging.

Filters

Reset

Price$40 – $180
$0$250
DistanceWithin 5 km
Rating4+
12345
Delivery timeUnavailable

Installation

npx axiom add slider
pnpm dlx axiom add slider
yarn dlx axiom add slider
bun x axiom add slider

Installs: react-native-reanimated, react-native-worklets, react-native-gesture-handler.

The value logic and gestures live in use-slider.ts, shared by every styling variant. Colors come from slider.default.{default,disabled}.{track,fill,thumb} in the component tokens.

Usage

import { Slider } from '@/components/ui/slider';

<Slider value={volume} onValueChange={setVolume} />
<Slider value={[min, max]} onValueChange={setPriceRange} />

Props

PropTypeDefaultDescription
valuenumber | [number, number]A number for one thumb, a tuple for a range with two thumbs.
defaultValuenumber | [number, number]minInitial value when the slider manages its own state.
onValueChange(value) => voidCalled continuously while dragging. Runs on the JS thread, so keep it cheap.
onSlidingComplete(value) => voidCalled once when the finger lifts. Use it for expensive work: a request, a refetch.
minnumber0Lowest value.
maxnumber100Highest value.
stepnumber1Increment the value snaps to. 0 means continuous.
minRangenumber0Smallest gap between the two thumbs of a range.
showStepsbooleanfalseDraws a tick for each step. Only use it when there are few steps.
disabledbooleanfalseBlocks dragging and dims the slider.
accessibilityLabelstringWhat the slider controls. Screen reader users change it with swipe up and down, by one step.
getAccessibilityValue(value) => stringText announced for the value, such as "5 kilometers".
styleStyleProp<ViewStyle>Extra styles for the container.

The thumb is 20pt but its touch area is 44pt, and the whole track accepts a tap to jump to a value.

Use cases

Media volume

A continuous slider between two icons that show the direction.

Clair de luneDebussy
<Slider
	value={volume}
	onValueChange={setVolume}
	min={0}
	max={1}
	step={0}
	accessibilityLabel="Volume"
	getAccessibilityValue={(v) => `${Math.round(v * 100)} percent`}
/>

Price range filter

Two thumbs with a minRange, and the request only sent when the user lets go.

Price per night
Minimum
$80
Maximum
$240
128 stays in this range
<Slider
	value={range}
	onValueChange={setRange}
	onSlidingComplete={(r) => refetch({ minPrice: r[0], maxPrice: r[1] })}
	min={0}
	max={500}
	step={10}
	minRange={20}
/>

Discrete steps

A small step count with showSteps, for a value with a few meaningful levels.

Text size

A
A
····

Apps that support Dynamic Type will adjust to your preferred reading size.

<Slider
	min={0}
	max={3}
	step={1}
	showSteps
	value={level}
	onValueChange={setLevel}
	accessibilityLabel="Text size"
/>