2.0.0 • Published 8 months ago
range-slider-element v2.0.0
<range-slider> element
A cross browser customizable and accessible <range-slider> web component.
Features
- Framework agnostic web component (no dependencies)
- Cross browser customizable styling
- Single and multi thumb
- Horizontal and vertical orientations
- Works like a built-in HTML form element (uses ElementInternals)
- Keyboard accessible (use arrow keys)
- Touch friendly
- Follows the ARIA best practices guide on sliders
Install
Install via npm
npm install range-slider-elementUsage
JavaScript
Import as ES module
import 'range-slider-element';Or via CDN
<script type="module" src="https://unpkg.com/range-slider-element@latest/dist/range-slider-element.js"></script>HTML
<range-slider min="0" max="100" step="1" value="50"></range-slider>CSS
Make sure to load the base styles exported via range-slider-element/style.css.
Or via CDN
<link rel="stylesheet" href="https://unpkg.com/range-slider-element@latest/dist/range-slider-element.css">Attributes
minThe minimum permitted value. The default is0.maxThe maximum permitted value. The default is100.stepThe stepping interval. The default is1.valueThe value. The default ismin + (max - min) / 2.dirDirectionality. The default is ltr. Allowed optionsrtl.orientationThe default is horizontal. Allowed optionsvertical.
Styling
CSS custom properties
Exposed CSS custom properties scoped within the range-slider element.
--track-size- The track size. The default is0.2rem. Can be overwritten for customization.--thumb-size- The thumb size. The default is1.2rem. Can be overwritten for customization.
DOM selectors
range-slider {}
range-slider [data-track] {}
range-slider [data-track-fill] {}
range-slider [data-thumb] {}
/* Advanced customization */
range-slider [data-runnable-track] {}For examples of how to customize the default styling, check out the docs.
Events
input- Pointer move, value changed. Bubbles.change- Pointer up, key up, value changed. Bubbles.
Browser support
Browsers without native custom element support require a polyfill.
License
Distributed under the MIT license. See LICENSE for details.
2.0.0-rc.2
9 months ago
1.1.0
9 months ago
2.0.0-rc.3
9 months ago
2.0.0-rc.4
9 months ago
2.0.0-rc.5
9 months ago
2.0.0-rc.0
9 months ago
2.0.0-rc.1
9 months ago
2.0.0-rc.6
9 months ago
2.0.0-rc.7
9 months ago
2.0.0
8 months ago
1.0.0
5 years ago
1.0.0-beta.7
6 years ago
1.0.0-beta.6
6 years ago
1.0.0-beta.5
6 years ago
1.0.0-beta.4
6 years ago
1.0.0-beta.3
6 years ago
1.0.0-beta.2
6 years ago
1.0.0-beta.1
6 years ago