Skip to content
Native Animation
Base Slider animation previewBase Slider animation preview

This preview uses fictional demo content. See the props below for the customization options available in this component.

npx nativeanimation add base-slider
Slider

Base Slider

React Native Slider Component

A value or range slider with spring-following thumbs and configurable bounds, step, and theme.

Native Animation Base · Free · MIT

Add to your project

Copy the component and its assets into your app with the Native Animation CLI, or paste the agent prompt into Claude Code, Codex or Cursor once the MCP server is connected.

About this component

Related guides

A value or range slider with spring-following thumbs and configurable bounds, step, and theme.

How it works

  1. The track measures its own width so it works inside cards and narrow forms.
  2. Pan and tap are combined exclusively, and positions snap to step values.
  3. Thumbs follow with the slider spring and stretch slightly while pressed.
  4. Change callbacks fire once per step; commit fires when the gesture settles.
  5. Range thumbs clamp against one another and expose adjustable semantics.

Install

npx nativeanimation add base-slider
npx expo install react-native-gesture-handler react-native-reanimated react-native-worklets

Usage

<BaseSlider value={volume} onValueChange={setVolume} accessibilityLabel="Volume" />
<BaseSlider value={range} min={0} max={100} step={5} onValueChange={setRange} onValueCommit={saveRange} />

Props

PropTypeDefaultDescription
valuenumber | [number, number]—Controlled value or range.
defaultValuenumber | [number, number]0Initial uncontrolled value.
onValueChange(value) => void—Called when a snapped step changes.
onValueCommit(value) => void—Called when a gesture ends.
minnumber0Minimum value.
maxnumber100Maximum value.
stepnumber1Increment between values.
disabledbooleanfalseDisables gestures and dims the control.
accessibilityLabelstringSliderAccessible name.
themeBaseThemeproviderOverrides the family theme.
testIDstring—Stable root and thumb identifiers.

Compatibility

Expo SDK 58 · React Native 0.88 · Reanimated 4.7 · react-native-worklets 0.13. Runs on iOS, Android, and web in Expo Go or a development build.

Accessibility

The control exposes an adjustable role with increment and decrement actions, min/max/current values, and a 44pt interaction area. Reduced motion removes spring settling while retaining step snapping.

Source code

Loading public source…