range-slider-element
range-slider-element copied to clipboard
π¬ <range-slider> custom element
<range-slider> element
A customizable range slider element.
Accessible range slider custom element with keyboard support.
Follows the ARIA best practices guide on sliders.
- No dependencies
- Customizable styling
- Touchscreen friendly
- Keyboard accessible
Install
$ npm install range-slider-element
Usage
import 'range-slider-element';
<range-slider min="0" max="100" step="1"></range-slider>
Attributes
minThe minimum permitted value. The default is 0.maxThe maximum permitted value. The default is 100.stepThe stepping interval. The default is 1.valueThe value. The default ismin + (max - min) / 2.dirDirectionality. The default is ltr.
Styling
Exposed CSS custom properties scoped within the range-slider element.
--value-percent- The current value in percentage, e.g. 50%
range-slider {}
range-slider .thumb-wrapper {}
range-slider .thumb {}
Events
input- Pointer move, value updated. Bubbles.change- Pointer up, value updated. Bubbles.
Browser support
Browsers without native custom element support require a polyfill.
License
MIT Β© AndrΓ© Ruffert