Skip to main content

rc-range-slider

Two-thumb range slider backed by native range inputs for min/max values, following the WAI-ARIA Multi-Thumb Slider pattern.

Package
@rcarls/rc-range-slider
Element
<rc-range-slider>
Native dependency
Requires two native range input children
State model
Controlled or uncontrolled numeric tuple
Main events
rc-range-slider-inputrc-range-slider-change

Installation

npm install @rcarls/rc-range-slider
import '@rcarls/rc-range-slider/define';

Live demo

Theming

The default demo mode shows the component without a package theme. Use the shared preview controls on this page to compare inherited, light, and dark color schemes or to apply the optional Material theme only inside the demo frames.

API

Properties

PropertyMarkupTypeDefaultDescription
minminnumber0Minimum slider value.
maxmaxnumber100Maximum slider value.
stepstepnumber1Slider step.
valueJS property only[number, number]Not specifiedCurrent [low, high] value. Assign a new tuple reference to trigger a re-render.
defaultValueJS property only[number, number] | undefinedNot specifiedInitial uncontrolled [low, high] value. Has no effect after the first user interaction or `value` write.
disableddisabledbooleanfalseDisable both thumbs and their hidden native input reflectors.
readonlyreadonlybooleanfalsePrevents edits while preserving normal focus and display.
lowLabellow-labelstring"Minimum"Accessible label for the low (min) thumb when the input does not provide one.
highLabelhigh-labelstring"Maximum"Accessible label for the high (max) thumb when the input does not provide one.
lowValueTextlow-value-textstring""Formatted screen-reader text for the low value. Falls back to the raw number.
highValueTexthigh-value-textstring""Formatted screen-reader text for the high value. Falls back to the raw number.
displaydisplayDisplayValuenullControls the live value display. - Absent (default) — no value shown. - `display` or `display="float"` — floats each value above its thumb. - `display="inline-start"` — renders the value container before the track. - `display="inline-end"` — renders the value container after the track.
orientationorientation"horizontal" | "vertical""horizontal"Orientation; reflected as an attribute and forwarded to custom thumbs.

Methods

No public methods are documented in the custom elements manifest.

Events

EventDetail typeDescription
typeCustomEventNo description provided.
rc-range-slider-inputNo detail type documentedFires while either thumb moves. Detail: `{ value }`.
rc-range-slider-changeNo detail type documentedFires when a thumb commits a new value. Detail: `{ value }`.

Slots

NameDescription
(default)Consumer-provided native range inputs.
track-backgroundOptional decorative content rendered inside the track before the selected range fill.
low-value-displayOptional replacement for the low value text.
high-value-displayOptional replacement for the high value text.

CSS Custom Properties

PropertyDefaultDescription
--rc-range-slider-accentHighlightAccent color for selected range, thumb border, focus, hover, and active states.
--rc-range-slider-gapvar(--rc-control-gap)Gap between track and inline value display.
--rc-range-slider-control-sizevar(--rc-control-block-size)Track hit-area block size.
--rc-range-slider-track-backgroundcolor-mix(in srgb, CanvasText 25%, Canvas)Unselected track color.
--rc-range-slider-track-radiusvar(--rc-control-radius)Track border radius.
--rc-range-slider-thumb-backgroundButtonFaceThumb background color.
--rc-range-slider-thumb-bordervar(--rc-range-slider-accent)Thumb border color.
--rc-range-slider-thumb-size1.125remVisual thumb inline/block size.
--rc-range-slider-value-colorvar(--rc-text-disabled)Value display text color.
--rc-thumb-radius9pxHalf the thumb width; used to align float value displays and range fill.
--rc-range-slider-float-value-block-offset-1.4emBlock-axis offset for horizontal float value displays.
--rc-range-slider-float-value-inline-offsetcalc(100% + 0.5rem)Inline-axis offset for vertical float value displays.

CSS Parts

PartDescription
rootRoot layout wrapper.
groupSlider group wrapper.
trackVisual slider track.
rangeFilled selected range segment.
thumbShared custom slider thumb.
low-thumbLow-value custom slider thumb.
high-thumbHigh-value custom slider thumb.
value-displayShared rendered value text.
low-value-displayRendered low value text.
high-value-displayRendered high value text.