Slider
A SwiftUI Slider component for selecting values from a range.
Expo UI Slider matches the official SwiftUI Slider API and allows selecting values from a bounded range.
Usage
Note:
Slideris a flexible-width component, it expands to fill available horizontal space and does not have an intrinsic width. When usingmatchContentson theHost, you should apply aframemodifier on theSliderto give it an explicit width. Alternatively, give theHostan explicit size usingstyle(for example,style={{ width: 300 }}orstyle={{ flex: 1 }}), or place theSliderinside a SwiftUI container likeFormthat provides width constraints.
Basic slider

Slider with custom range

Slider with step
Use the step prop to define discrete increments. Set step to 0 for continuous values.

Slider with labels
You can add labels to describe a slider's purpose and to mark the minimum and maximum value positions.
import { useState } from 'react';
import { Host, Slider, Text } from '@expo/ui/swift-ui';
export default function LabeledSliderExample() {
const [value, setValue] = useState(50);
return (
<Host style={{ flex: 1 }}>
<Slider
value={value}
min={0}
max={100}
label={<Text>Volume</Text>}
minimumValueLabel={<Text>0</Text>}
maximumValueLabel={<Text>100</Text>}
onValueChange={setValue}
/>
</Host>
);
}
API
import { Slider } from '@expo/ui/swift-ui';Component
Slider
Type: React.Element<SliderProps>
SliderProps
label
Optional • Type: ReactNode
A label describing the slider's purpose.
lowerLimit
Optional • Type: number
Lower limit the user can drag the thumb to. The visible track still spans min..max, but the thumb stops at lowerLimit during drag.
max
Optional • Type: number
The maximum value of the slider. Updating this value does not trigger callbacks if the current value is above max.
maximumValueLabel
Optional • Type: ReactNode
A label displayed at the maximum value position.
min
Optional • Type: number
The minimum value of the slider. Updating this value does not trigger callbacks if the current value is below min.
minimumValueLabel
Optional • Type: ReactNode
A label displayed at the minimum value position.
onEditingChanged
Optional • Type: (isEditing: boolean) => void
Callback triggered when the user starts or ends editing the slider.
onValueChange
Optional • Type: (value: number) => void
Callback triggered on dragging along the slider.
step
Optional • Type: number
The step increment for the slider.
upperLimit
Optional • Type: number
Upper limit the user can drag the thumb to. The visible track still spans min..max, but the thumb stops at upperLimit during drag.
value
Optional • Type: number
The current value of the slider.
Inherited props
Modifiers
Use these modifiers in the modifiers prop of the SwiftUI and Universal version.
The Drop-in version does not accept modifiers.
Expo UI lets you put any of the 89 modifiers for any view on Slider, but not all of them do something here.
- 48 change what you see on Slider.
- 1 work, but not in the way that you may expect.
- 28 have no visible effect on Slider.
- 13 work only in one place, such as a widget or a
Grid.
Best modifiers for Slider
These modifiers are made for Slider, or they are the ones that you use most with it.
Also works on Slider
Slider takes these modifiers too, and each one works in the usual way.
accessibilityAddTraitsaccessibilityHiddenaccessibilityHintaccessibilityIdentifieraccessibilityInputLabelsaccessibilityLabelaccessibilityRemoveTraitsaccessibilityValueaspectRatiobackgroundbackgroundOverlayblurborderbrightnessclippedclipShapecolorInvertcontainerRelativeFrameiOS 17+contentShapecontrastcornerRadiusenvironmentfixedSizeforegroundColorforegroundStyleglassEffectgrayscalehiddenhueRotationidignoreSafeArealuminanceToAlphamaskoffsetopacityoverlayredactedrotation3DEffectrotationEffectsaturationscaleEffectshadowstrokeBorder
Needs care on Slider
These modifiers work on Slider, but not in the way that you may expect.
| Modifier | What to know |
|---|---|
animation | The Slider animates its own thumb. Use this for the other modifiers on the slider. |
No visible effect on Slider
Slider accepts these modifiers, but you see no change. They do not give an error.
| Modifier | Why nothing happens |
|---|---|
accessibilityElement | It joins the child views into one accessibility element, and Slider takes no child views. |
allowsTightening | It changes only text, and Slider shows no text. |
bold | It changes only text and SF Symbols, and Slider shows neither. |
containerShape | It sets the shape that the child views use for containerRelativeShape, and Slider takes no child views. |
contentTransition iOS 16+ | It changes how text and SF Symbols animate when their content changes, and Slider shows neither. |
dynamicTypeSize | It changes only text and SF Symbols, and Slider shows neither. |
font | It changes only text and SF Symbols, and Slider shows neither. |
geometryGroup iOS 17+ | It works on the child views that you give the component, and Slider takes none. |
imageScale | It changes only SF Symbols, and Slider shows none. |
italic | It changes only text, and Slider shows no text. |
kerning | It changes only text, and Slider shows no text. |
layoutPriority | It has an effect only when the view shares an axis with other views in a stack. |
lineHeight iOS 26+ | It changes only text, and Slider shows no text. |
lineLimit | It changes only text, and Slider shows no text. |
lineSpacing | It changes only text, and Slider shows no text. |
minimumScaleFactor | It changes only text, and Slider shows no text. |
monospacedDigit | It changes only text, and Slider shows no text. |
multilineTextAlignment | It changes only text, and Slider shows no text. |
onAppear | In SDK 57, Slider does not send modifier events to JavaScript, so the handler does not run. |
onDisappear | In SDK 57, Slider does not send modifier events to JavaScript, so the handler does not run. |
onGeometryChange | In SDK 57, Slider does not send modifier events to JavaScript, so the handler does not run. |
onLongPressGesture | In SDK 57, Slider does not send modifier events to JavaScript, so the handler does not run. |
onTapGesture | In SDK 57, Slider does not send modifier events to JavaScript, so the handler does not run. |
strikethrough | It changes only text, and Slider shows no text. |
textCase | It changes only text, and Slider shows no text. |
truncationMode | It changes only text, and Slider shows no text. |
underline | It changes only text, and Slider shows no text. |
zIndex | It changes the order of views that cover each other in the same parent, and Slider does not stack its children. |
Only in some places
These modifiers work only in a widget, in a Grid, in a Namespace or in a parent that asks for them.
| Modifier | Where it works |
|---|---|
activityBackgroundTint | Works only in a Live Activity. It has no effect in the app. |
alignmentGuide | Has an effect only when the parent, such as a VStack or ZStack, aligns its children by the same guide. |
containerBackground | Works only in a widget, or in a navigation container when you use a navigation placement. |
glassEffectId | Works only on a view that also has glassEffect, in a GlassEffectContainer and a Namespace. |
gridCellAnchor iOS 16+ | Works only on a cell of a Grid. Grid is in @expo/ui/swift-ui, but it has no Expo docs page. |
gridCellColumns | Works only on a view in a Grid.Row. Grid is in @expo/ui/swift-ui, but it has no Expo docs page. |
gridCellUnsizedAxes | Works only on a view in a Grid. Grid is in @expo/ui/swift-ui, but it has no Expo docs page. |
gridColumnAlignment iOS 16+ | Works only on a view in a Grid.Row. Grid is in @expo/ui/swift-ui, but it has no Expo docs page. |
invalidatableContent iOS 17+ | Has an effect only when a parent view uses redacted with the invalidated reason. |
matchedGeometryEffect | Works only in a Namespace. Give two views the same id and change between them with an animation. |
privacySensitive | Has an effect only when a parent view uses redacted with the privacy reason. |
unredacted | Has an effect only in a parent view that uses redacted. |
widgetURL | Works only in a widget. It has no effect in the app. |
Sources
The original Expo docs for this page:
- Slider (SwiftUI) (
source-of-truth/versions/v57.0.0/sdk/ui/swift-ui/slider.md) - Slider (Universal) (
source-of-truth/versions/v57.0.0/sdk/ui/universal/slider.md) - Slider (Drop-in) (
source-of-truth/versions/v57.0.0/sdk/ui/drop-in-replacements/slider.md)



