Skip to components
DEVELOPER REFERENCE · v4.0.0

PreactRangeSlider API

Props, callbacks and methods. Select an underlined type to explore its fields, allowed values and callback arguments.

PreactRangeSlider21 props2 callbacks0 methods

Props21

PreactRangeSlider props
NameTypeDescription
minRequirednumberMinimum value for the range
maxRequirednumberMaximum value for the range
fromValueRequirednumberCurrent value for the start of the range
toValueRequirednumberCurrent value for the end of the range
stepOptionalnumber | undefinedValue-domain increment for native range handles. Defaults to the slider's decimal precision.
showTooltipsOptionalboolean | undefinedWhether to show tooltips on hover
showRangeDisplayOptionalboolean | undefinedWhether to show the current range values above the slider
showRangeInputsOptionalboolean | undefinedWhether to show numeric inputs for editing the selected range
disabledOptionalboolean | undefinedDisable both native range handles.
scaleFactorOptionalnumber | undefinedScaling used to preserve decimals in native range inputs. Defaults to 100.
classNameOptionalstring | undefinedExtra class on the shared slider root.
controlClassNameOptionalstring | undefinedExtra class on the shared dual-handle control.
fromClassNameOptionalstring | undefinedExtra classes retained by feature adapters.
toClassNameOptionalstring | undefinedAdditional CSS classes for the to part of the component.
fromAriaLabelOptionalstring | undefinedAccessible names for the two native range handles.
toAriaLabelOptionalstring | undefinedAccessible label for the upper endpoint of the range slider.
formatInputValueOptional
((value: number) => string) | undefinedInspect type
Optional function to format values inside the editable inputs. Defaults to `String(value)`, which keeps dot decimals independent of the browser's localized number input rendering.
parseInputValueOptional
((value: string) => number) | undefinedInspect type
Optional function to parse editable input text back to a number. Return `NaN` to ignore incomplete or invalid text while the user is typing. The default parser accepts both dot and comma decimal separators.
formatValueOptional
((value: number) => string) | undefinedInspect type
Optional function to format read-only labels and tooltips. Editable inputs use `formatInputValue` so display labels and input text can intentionally use different formats.
formatFromValueOptional
((value: number) => string) | undefinedInspect type
Optional handle-specific display/accessible value formatters.
formatToValueOptional
((value: number) => string) | undefinedInspect type
Formats the upper endpoint value of a range slider.

Events and callbacks2

PreactRangeSlider events and callbacks
NameTypeDescription
onRangeChangeRequired
(range: SliderRange) => voidInspect type
Callback fired when the range values change
onRangeCommitOptional
((range: SliderRange) => void) | undefinedInspect type
Callback fired when a native handle commits its change.

Methods0

No component-specific imperative methods. Use props and callbacks to control this component.