This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 55).

Slider

A control for selecting a value from a continuous or stepped range.

Android
iOS
Web
Included in Expo Go

For the complete documentation index, see llms.txt. Use this file to discover all available pages.

A controlled slider for selecting a numeric value within a range. Pair value with onValueChange to manage state from React.

Installation

Terminal
npx expo install @expo/ui

If you are installing this in an existing React Native app, make sure to install expo in your project.

Usage

Continuous slider

The default range is [0, 1].

ContinuousSliderExample.tsx
import { useState } from 'react'; import { Host, Slider } from '@expo/ui'; export default function ContinuousSliderExample() { const [value, setValue] = useState(0.5); return ( <Host style={{ flex: 1 }}> <Slider value={value} onValueChange={setValue} /> </Host> ); }

Stepped slider with custom range

Use min, max, and step to constrain the values produced by the slider.

SteppedSliderExample.tsx
import { useState } from 'react'; import { Host, Column, Slider, Text } from '@expo/ui'; export default function SteppedSliderExample() { const [volume, setVolume] = useState(50); return ( <Host style={{ flex: 1 }}> <Column spacing={8}> <Text>Volume: {volume}</Text> <Slider value={volume} onValueChange={setVolume} min={0} max={100} step={10} /> </Column> </Host> ); }

API

import { Slider } from '@expo/ui';

No API data file found, sorry!