Slider API

API documentation for Slider component

Slider#

Props#

Defines valid properties in Slider component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: SliderInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: SliderInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<SliderPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: SliderInstance) => ReactNode)
null
The children to render.
disabledboolean
false
When present, it specifies that the element should be disabled.
onValueChange(event: SliderChangeEvent) => void
null
Callback fired when the ToggleButton's pressed state changes.
valuenumber | number[]
null
Value of the component.
defaultValuenumber | number[]
null
The default value for the input when not controlled by `value` .
minnumber
0
Mininum boundary value.
maxnumber
100
Maximum boundary value.
orientation"horizontal" | "vertical"
horizontal
Orientation of the slider.
stepnumber
1
Step factor to increment/decrement the value.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

State#

Defines valid state in Slider component.

nametypedefaultdescription
valuenumber | number[]
null
Value of the component.

Exposes#

Defines the methods and properties exposed by Slider component.

nametypedefaultdescription
stateuseSliderState
null
The state of the useSlider.
registerThumb() => number
null
Registers a thumb and returns its index.
thumbCounterMutableRefObject<number>
null
Counter for tracking number of thumbs.
range() => boolean
null
Determines if the slider is in range mode.
onTouchStart(event: TouchEvent<HTMLElement>, index: number) => void
null
Handler for touch start events.
onDrag(event: MouseEvent<Element, MouseEvent> | TouchEvent<Element>) => void
null
Handler for drag events.
onDragEnd() => void
null
Handler for drag end events.
onMouseDown(event: MouseEvent<HTMLElement>, index: number) => void
null
Handler for mouse down events.
onKeyDown(event: KeyboardEvent, index: number) => void
null
Handler for key down events.
rangeStyle() => CSSProperties
null
Returns the style object for the range.
handleThumbStyle() => CSSProperties
null
Returns the style object for the handle thumb.
rangeStartHandleStyle() => CSSProperties
null
Returns the style object for the range start handle.
rangeEndHandleStyle() => CSSProperties
null
Returns the style object for the range end handle.

Events#

Event fired when the Slider's value changes.

nametypedescription
valuenumber | number[]The pressed state of the ToggleButton.
originalEventSyntheticEventThe original event that triggered the change.

Interfaces#

Defines passthrough(pt) options of Slider component.

nametypedefaultdescription
rootSliderPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.
rangeSliderPassThroughType<HTMLAttributes<HTMLSpanElement>>
null
Used to pass attributes to the range's DOM element.
thumbSliderPassThroughType<HTMLAttributes<HTMLSpanElement>>
null
Used to pass attributes to the thumb's DOM element.

Types#

Instance of Slider component.

values
ComponentInstance<SliderProps, SliderState, SliderExposes>

SliderRange#

Props#

Defines valid properties in SliderRange component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: SliderRangeInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: SliderRangeInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<SliderRangePassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: SliderRangeInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by SliderRange component.

nametypedefaultdescription
sliderSliderInstance
null
The Slider component instance.

Interfaces#

Defines passthrough(pt) options of SliderRange component.

nametypedefaultdescription
rootSliderRangePassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of SliderRange component.

values
ComponentInstance<SliderRangeProps, SliderRangeState, SliderRangeExposes>

SliderThumb#

Props#

Defines valid properties in SliderThumb component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: SliderThumbInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: SliderThumbInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<SliderThumbPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: SliderThumbInstance) => ReactNode)
null
The children to render.
tabIndexnumber
0
Index of the element in tabbing order.
ariaLabelstring
null
Establishes a string value that labels the component.
ariaLabelledbystring
null
Establishes relationships between the component and label(s) where its value should be one or more element IDs.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by SliderThumb component.

nametypedefaultdescription
sliderSliderInstance
null
The Slider component instance.

Interfaces#

Defines passthrough(pt) options of SliderThumb component.

nametypedefaultdescription
rootSliderThumbPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of SliderThumb component.

values
ComponentInstance<SliderThumbProps, SliderThumbState, SliderThumbExposes>

useSlider#

Props#

Defines valid properties in useSlider.

nametypedefaultdescription
valuenumber | number[]
null
Value of the component.
defaultValuenumber | number[]
null
The default value for the input when not controlled by `value` .
minnumber
0
Mininum boundary value.
maxnumber
100
Maximum boundary value.
orientation"horizontal" | "vertical"
horizontal
Orientation of the slider.
stepnumber
1
Step factor to increment/decrement the value.
onValueChange(event: useSliderChangeEvent) => void
null
Callback fired when the ToggleButton's pressed state changes.

State#

Defines valid state in useSlider.

nametypedefaultdescription
valuenumber | number[]
null
Value of the component.

Exposes#

Defines the methods and properties exposed by useSlider.

nametypedefaultdescription
stateuseSliderState
null
The state of the useSlider.
registerThumb() => number
null
Registers a thumb and returns its index.
thumbCounterMutableRefObject<number>
null
Counter for tracking number of thumbs.
range() => boolean
null
Determines if the slider is in range mode.
onTouchStart(event: TouchEvent<HTMLElement>, index: number) => void
null
Handler for touch start events.
onDrag(event: MouseEvent<Element, MouseEvent> | TouchEvent<Element>) => void
null
Handler for drag events.
onDragEnd() => void
null
Handler for drag end events.
onMouseDown(event: MouseEvent<HTMLElement>, index: number) => void
null
Handler for mouse down events.
onKeyDown(event: KeyboardEvent, index: number) => void
null
Handler for key down events.
rangeStyle() => CSSProperties
null
Returns the style object for the range.
handleThumbStyle() => CSSProperties
null
Returns the style object for the handle thumb.
rangeStartHandleStyle() => CSSProperties
null
Returns the style object for the range start handle.
rangeEndHandleStyle() => CSSProperties
null
Returns the style object for the range end handle.

Events#

Event fired when the Slider's value changes.

nametypedescription
originalEventEThe original event that triggered the change.
valuenumber | number[]The pressed state of the ToggleButton.

Types#

Instance of useSlider headless.

values
HeadlessInstance<useSliderProps, useSliderState, useSliderExposes>