This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 54).
Slider
A Jetpack Compose Slider component for selecting values from a range.
A slider component that allows users to select a value from a continuous range by dragging a thumb along a track.
Installation
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
import { Slider } from '@expo/ui/jetpack-compose'; <Slider style={{ minHeight: 60 }} value={value} onValueChange={(value) => { setValue(value); }} />
See official Jetpack Compose documentation for more information.
API
import { Slider } from '@expo/ui/jetpack-compose';
Component
Type: React.Element<SliderProps>
number • Default: 1The maximum value of the slider. Updating this value does not trigger callbacks if the current value is above max.
number • Default: 0The minimum value of the slider. Updating this value does not trigger callbacks if the current value is below min.
(value: number) => voidCallback triggered on dragging along the slider.
number • Default: 0The number of steps between the minimum and maximum values, 0 signifies infinite steps.
Types
Colors for slider's core elements.
| Property | Type | Description |
|---|---|---|
| activeTickColor(optional) | ColorValue | - |
| activeTrackColor(optional) | ColorValue | - |
| inactiveTickColor(optional) | ColorValue | - |
| inactiveTrackColor(optional) | ColorValue | - |
| thumbColor(optional) | ColorValue | - |