Slider

Examples

Basic usage

Range Slider

Custom step, min and max

Marks at each step

Mark with labels

Mark with custom labels

Disabled

Stateful Slider (Uncontrolled)

Intents

Overrides usage

Custom Intent Color

Intent colors of Slider component can be changed by providing custom values to primaryIntentColor and secondaryIntentColor props

API

Slider props

NameTypeDefaultDescription
className
string
Enriched style to be provided to Slider Root
disabled
boolean
falseslider will be disabled
getMarkLabel
function
Provide custom label for marks.
intent
'default'| 'error'| 'warning'| 'success'
defaultIntent of slider component
markLabel
boolean
falseDisplays text label on each steps.
marks
boolean
falseDisplays mark on each step.
max
number
100Maximum value for range of slider.
min
number
0Minimum value for range of slider.
onChange
function
called when value changes
onFinalChange
function
called when user is done with changing
overrides
custom
Lets you customize all aspects of the component.
persistentThumb
boolean
falseCauses the value/thumb to always display.
primaryIntentColor
string
custom primary intent color of the slider component
secondaryIntentColor
string
custom secondary intent color of the slider component
step
number
1Step size
style
function
Passes style function, object or string to the Slider Root.
value
array
Value for the slider component.
valueToLabel
function
Used to transform the thumb value/min/max labels into a user-friendly label.

You can check the implementation of the component for more details.

Slider exports

You can import this module like so:

import {Slider} from 'spaceweb/slider'

It exports the following components or utility functions:

  • Slider
  • StatefulSlider
  • StatefulSliderContainer