Slider

đź“”
This component is in an experimental state; you can use it in your app. However, we may modify it, and it may even have breaking changes in the future.

The Slider component allows you to select a numeric value between a range specified by minimum and maximum values.

Properties

autoFocus (default: false)

If this property is set to true, the component gets the focus automatically when displayed.

enabled (default: true)

This boolean property value indicates whether the component responds to user events (true) or not (false).

initialValue

This property sets the component's initial value.

label

This property sets the label of the component.

labelBreak (default: false)

This boolean value indicates if the Slider labels can be split into multiple lines if it would overflow the available label width.

labelPosition (default: "top")

Places the label at the given position of the component.

Available values:

ValueDescription
startThe left side of the input (left-to-right) or the right side of the input (right-to-left)
endThe right side of the input (left-to-right) or the left side of the input (right-to-left)
topThe top of the input (default)
bottomThe bottom of the input

labelWidth

This property sets the width of the Slider.

maxValue (default: 10)

This property specifies the maximum value of the allowed input range.

minStepsBetweenThumbs

This property sets the minimum number of steps required between multiple thumbs on the slider, ensuring they maintain a specified distance.

minValue (default: 0)

This property specifies the minimum value of the allowed input range.

rangeStyle

This property allows you to apply custom styles to the range element of the slider.

readOnly (default: false)

Set this property to true to disallow changing the component value.

required

Set this property to true to indicate it must have a value before submitting the containing form.

showValues (default: true)

This property controls whether the slider shows the current values of the thumbs.

step

This property defines the increment value for the slider, determining the allowed intervals between selectable values.

thumbStyle

This property allows you to apply custom styles to the thumb elements of the slider.

validationStatus (default: "none")

This property allows you to set the validation status of the input component.

Available values:

ValueDescription
validVisual indicator for an input that is accepted
warningVisual indicator for an input that produced a warning
errorVisual indicator for an input that produced an error

valueFormat

This property allows you to customize how the values are displayed.

Events

didChange

This event is triggered when value of Slider has changed.

gotFocus

This event is triggered when the Slider has received the focus.

lostFocus

This event is triggered when the Slider has lost the focus.

Exposed Methods

focus

This method sets the focus on the Slider.

setValue

You can use this method to set the component's current value programmatically (true: checked, false: unchecked).

value

You can query the component's value. If no value is set, it will retrieve undefined.

Styling

Theme Variables

VariableDefault Value (Light)Default Value (Dark)
backgroundColor-range-Slider$color-primary$color-primary
backgroundColor-range-Slider$color-primary$color-primary
backgroundColor-range-Slider--disabled$color-surface-400$color-surface-800
backgroundColor-range-Slider--disabled$color-surface-400$color-surface-800
backgroundColor-thumb-Slider$color-primary-500$color-primary-400
backgroundColor-thumb-Slider$color-primary-500$color-primary-400
backgroundColor-track-Slider$color-surface-200$color-surface-200
backgroundColor-track-Slider$color-surface-200$color-surface-200
backgroundColor-track-Slider--disabled$color-surface-300$color-surface-600
backgroundColor-track-Slider--disabled$color-surface-300$color-surface-600
borderColor-Slider-defaulttransparenttransparent
borderColor-Slider-defaulttransparenttransparent
borderColor-Slider-default--focus

none

none

borderColor-Slider-default--hover

none

none

borderColor-Slider-error

none

none

borderColor-Slider-error--focus

none

none

borderColor-Slider-error--hover

none

none

borderColor-Slider-success

none

none

borderColor-Slider-success--focus

none

none

borderColor-Slider-success--hover

none

none

borderColor-Slider-warning

none

none

borderColor-Slider-warning--focus

none

none

borderColor-Slider-warning--hover

none

none

borderColor-thumb-Slider$color-surface-50$color-surface-950
borderColor-thumb-Slider$color-surface-50$color-surface-950
borderRadius-Slider-default$borderRadius$borderRadius
borderRadius-Slider-default$borderRadius$borderRadius
borderRadius-Slider-error

none

none

borderRadius-Slider-success

none

none

borderRadius-Slider-warning

none

none

borderStyle-Slider-defaultsolidsolid
borderStyle-Slider-defaultsolidsolid
borderStyle-Slider-error

none

none

borderStyle-Slider-success

none

none

borderStyle-Slider-warning

none

none

borderStyle-thumb-Slidersolidsolid
borderStyle-thumb-Slidersolidsolid
borderWidth-Slider-default00
borderWidth-Slider-default00
borderWidth-Slider-error

none

none

borderWidth-Slider-success

none

none

borderWidth-Slider-warning

none

none

borderWidth-thumb-Slider2px2px
borderWidth-thumb-Slider2px2px
boxShadow-Slider-defaultnonenone
boxShadow-Slider-defaultnonenone
boxShadow-Slider-default--focus

none

none

boxShadow-Slider-default--hover

none

none

boxShadow-Slider-error

none

none

boxShadow-Slider-error--focus

none

none

boxShadow-Slider-error--hover

none

none

boxShadow-Slider-success

none

none

boxShadow-Slider-success--focus

none

none

boxShadow-Slider-success--hover

none

none

boxShadow-Slider-warning

none

none

boxShadow-Slider-warning--focus

none

none

boxShadow-Slider-warning--hover

none

none

boxShadow-thumb-Slider$boxShadow-md$boxShadow-md
boxShadow-thumb-Slider$boxShadow-md$boxShadow-md
boxShadow-thumb-Slider--focus$boxShadow-xl$boxShadow-xl
boxShadow-thumb-Slider--hover$boxShadow-lg$boxShadow-lg