Reference version

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

A SwiftUI Slider component for selecting values from a range.

iOS

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

import { Host, Slider } from '@expo/ui/swift-ui'; <Host style={{ minHeight: 60 }}> <Slider value={value} onValueChange={(value) => { setValue(value); }} /> </Host>

See Official SwiftUI documentation for more information.

API

Component

Slider

iOS

Type: React.Element<SliderProps>

SliderProps

color

iOS
Optional • Type: ColorValue

Slider color.

max

iOS
Optional • Type: number • Default: 1

The maximum value of the slider. Updating this value does not trigger callbacks if the current value is above max.

min

iOS
Optional • Type: number • Default: 0

The minimum value of the slider. Updating this value does not trigger callbacks if the current value is below min.

onValueChange

iOS
Optional • Type: (value: number) => void

Callback triggered on dragging along the slider.

steps

iOS
Optional • Type: number • Default: 0

The number of steps between the minimum and maximum values, 0 signifies infinite steps.

value

iOS
Optional • Type: number • Default: 0

The current value of the slider.