Components
Range slider

Range Slider

A range slider is a multi-thumb slider used to select a range between two numbers.

API reference docs for the component. Learn about the props, CSS, and other APIs of this exported module.

RangeSliderProps

aria-label

string[]

The aria-label of each slider thumb. Useful for providing an accessible name to the slider

aria-labelledby

string[]

The `id` of the elements that labels each slider thumb. Useful for providing an accessible name to the slider

defaultValue

number[]

dir

'ltr' | 'rtl'

The document's text/writing direction.

disabled

boolean

Whether the slider is disabled

form

string

The associate form of the underlying input element.

getAriaValueText

(value: number, index: number) => string

Function that returns a human readable value for the slider thumb

getRootNode

() => ShadowRoot | Node | Document

A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.

id

string

The unique identifier of the machine.

ids

Partial<{ root: string thumb(index: number): string control: string track: string range: string label: string output: string marker(index: number): string }>

The ids of the elements in the range slider. Useful for composition.

invalid

boolean

Whether the slider is invalid

max

number

The maximum value of the slider

min

number

The minimum value of the slider

minStepsBetweenThumbs

number

The minimum permitted steps between multiple thumbs.

name

string

The name associated with each slider thumb (when used in a form)

onFocusChange

(details: FocusChangeDetails) => void

Function invoked when the slider's focused index changes

onValueChange

(details: ValueChangeDetails) => void

Function invoked when the value of the slider changes

onValueChangeEnd

(details: ValueChangeDetails) => void

Function invoked when the slider value change is done

onValueChangeStart

(details: ValueChangeDetails) => void

Function invoked when the slider value change is started

orientation

'horizontal' | 'vertical'

The orientation of the slider

readOnly

boolean

Whether the slider is read-only

step

number

The step value of the slider

thumbAlignment

'center' | 'contain'

The alignment of the slider thumb relative to the track - `center`: the thumb will extend beyond the bounds of the slider track. - `contain`: the thumb will be contained within the bounds of the track.

thumbSize

{ width: number; height: number }

The slider thumbs dimensions

value

number[]

The value of the range slider

RangeSliderContext

controlProps

Dict<any>

decrement

(index: number) => void

Function to decrement the value of the slider at the given index.

focus

() => void

Function to focus the slider. This focuses the first thumb.

getHiddenInputProps

(index: number) => Dict<any>

getMarkerProps

(props: MarkerProps) => Dict<any>

getPercentValue

(percent: number) => number

Returns the value of the thumb at the given percent.

getThumbMax

(index: number) => number

Returns the max value of the thumb at the given index.

getThumbMin

(index: number) => number

Returns the min value of the thumb at the given index.

getThumbPercent

(index: number) => number

Returns the percent of the thumb at the given index.

getThumbProps

(index: number) => Dict<any>

getThumbValue

(index: number) => number

Returns the value of the thumb at the given index.

getValuePercent

(value: number) => number

Returns the percent of the thumb at the given index.

increment

(index: number) => void

Function to increment the value of the slider at the given index.

isDragging

boolean

Whether the slider is being dragged.

isFocused

boolean

Whether the slider is focused.

labelProps

Dict<any>

markerGroupProps

Dict<any>

outputProps

Dict<any>

rangeProps

Dict<any>

rootProps

Dict<any>

setThumbPercent

(index: number, percent: number) => void

Sets the percent of the thumb at the given index.

setThumbValue

(index: number, value: number) => void

Sets the value of the thumb at the given index.

setValue

(value: number[]) => void

Function to set the value of the slider.

trackProps

Dict<any>

value

number[]

The value of the slider.

RangeSliderThumbProps

index

number

RangeSliderMarkerProps

value

number