Slider
Sliders allow users to select a value from a fixed set of values using drag utility.
#
Usage#
Props#
Slider- allowTouchTrack
- animateTransitions
- animationConfig
- animationType
- containerStyle
- debugTouchArea
- disabled
- maximumTrackTintColor
- maximumValue
- minimumTrackTintColor
- minimumValue
- onSlidingComplete
- onSlidingStart
- onValueChange
- orientation
- step
- style
- thumbProps
- thumbStyle
- thumbTintColor
- thumbTouchSize
- trackStyle
- value
#
Reference#
Slider#
allowTouchTrackIf true, thumb will respond and jump to any touch along the track.
Type | Default |
---|---|
boolean | false |
#
animateTransitionsSet to true if you want to use the default 'spring' animation.
Type | Default |
---|---|
boolean | None |
#
animationConfigUsed to configure the animation parameters. These are the same parameters in the Animated library.
Type | Default |
---|---|
TimingAnimationConfig or SpringAnimationConfig | None |
#
animationTypeSet to 'spring' or 'timing' to use one of those two types of animations with the default animation properties.
Type | Default |
---|---|
"timing" or "spring" | timing |
#
containerStyleApply style to the container of the slider.
Type | Default |
---|---|
Style Object | None |
#
debugTouchAreaSet this to true to visually see the thumb touch rect in green.
Type | Default |
---|---|
boolean | false |
#
disabledIf true the user won't be able to move the slider.
Type | Default |
---|---|
boolean | None |
#
maximumTrackTintColorThe color used for the track to the right of the button.
Type | Default |
---|---|
string | #b3b3b3 |
#
maximumValueInitial maximum value of the slider.
Type | Default |
---|---|
number | 1 |
#
minimumTrackTintColorThe color used for the track to the left of the button.
Type | Default |
---|---|
string | #3f3f3f |
#
minimumValueInitial minimum value of the slider.
Type | Default |
---|---|
number | 0 |
#
onSlidingCompleteCallback called when the user finishes changing the value (e.g. when the slider is released).
Type | Default |
---|---|
(value: number) => void | None |
#
onSlidingStartCallback called when the user starts changing the value (e.g. when the slider is pressed).
Type | Default |
---|---|
(value: number) => void | None |
#
onValueChangeCallback continuously called while the user is dragging the slider.
Type | Default |
---|---|
(value: number) => void | None |
#
orientationSet the orientation of the slider.
Type | Default |
---|---|
"vertical" or "horizontal" | horizontal |
#
stepStep value of the slider. The value should be between 0 and maximumValue - minimumValue).
Type | Default |
---|---|
number | 0 |
#
styleThe style applied to the slider container.
Type | Default |
---|---|
View style(Object) | None |
#
thumbPropsThe props applied to the thumb. Uses Component
prop which can accept Animated
components.
Type | Default |
---|---|
any | None |
#
thumbStyleThe style applied to the thumb.
Type | Default |
---|---|
View style(Object) | None |
#
thumbTintColorThe color used for the thumb.
Type | Default |
---|---|
string | red |
#
thumbTouchSizeThe size of the touch area that allows moving the thumb. The touch area has the same center as the visible thumb. This allows to have a visually small thumb while still allowing the user to move it easily.
Type | Default |
---|---|
Sizable | { width: THUMB_SIZE, height: THUMB_SIZE } |
#
trackStyleThe style applied to the track.
Type | Default |
---|---|
View style(Object) | None |
#
valueInitial value of the slider.
Type | Default |
---|---|
number | 0 |