Range Slider

Capture input from a range of values, including optional ticks.

javascript
import { RangeSlider } from '@brainandbones/skeleton';

Value 25

Usage

html
<RangeSlider bind:value={50} max={100} step={5} ticked>Label</RangeSlider>

Properties

This component makes use of $$restProps, which allows arbitrary attributes to be provided to the component.

Prop Type Default Description
valuenumber0Set the input value.
minnumber0Set the input minimum range.
maxnumber100Set the input maximum range.
stepnumber1Set the input step offset.
tickedbooleanfalseEnables tick marks. See browser support below.
accentstringaccent-accent-500Provide classes to set the input accent color.

Slots

Prop Description
DefaultA label slot directly above the range slider element.

Accessibility

ARIA Guidelines
Prop Type Description
idstringProvide a unique input id.
labelstringA semantic ARIA label.

Keyboard Interactions

Keys Description
Right Arrow or Up ArrowIncrease the value of the slider by one step.
Left Arrow or Down ArrowDecrease the value of the slider by one step.
HomeSet the slider to the first allowed value in its range.
EndSet the slider to the last allowed value in its range.
Page UpIncrease the slider value by an amount larger than the step change made by Up Arrow.
Page DownDecrease the slider value by an amount larger than the step change made by Up Down.

Browser Support

This component utilizes native HTML range inputs. Browser support is limited for native datalist element, which display the generated tickmarks. Additionally, some browsers (such as Chrome) alter the track color to ensure contrast between the track and meter. Please keep accessibility in mind when utilizing this component.