<range-slider>
Playground
Copy the HTML
Attempt modifying the CSS
Copy the CSS
The <enter kind="vary">
HTML factor can be utilized to create fundamental sliders, however it’s tough to fashion throughout browsers. The <range-slider>
customized factor helps obtain accessible sliders that may be styled as wanted.
Set up
Set up through npm
Utilization
JavaScript
Import as ES module
Or through CDN
HTML
CSS
Be certain that to load the bottom types exported through range-slider-element/fashion.css
.
Or through CDN
Attributes
min
The minimal permitted worth. The default is0
.max
The utmost permitted worth. The default is100
.step
The stepping interval. The default is1
.worth
The worth. The default is50
(min + (max - min) / 2
).dir
Directionality. The default is ltr. Allowed choicesrtl
.orientation
The default is horizontal. Allowed choicesvertical
.
Styling
CSS customized properties
Uncovered CSS customized properties scoped throughout the range-slider
factor.
-
--track-size
– The observe measurement. The default is
0.2rem
. Might be overwritten for personalization. -
--thumb-size
– The thumb measurement, The default is1.2rem
.
Might be overwritten for personalization.
DOM selectors
range-slider [data-track] {}
range-slider [data-track-fill] {}
range-slider [data-thumb] {}
/* Superior customization */
range-slider [data-runnable-track] {}
Occasions
enter
– Pointer transfer, worth modified. Bubbles.
change
– Pointer up, key up, worth modified. Bubbles.
enter
– Pointer transfer, worth modified. Bubbles.change
– Pointer up, key up, worth modified. Bubbles.This venture makes use of SemVer for launch versioning and most backward compatibility. Full changelog.
For extra examples checkout the CodePen <range-slider> assortment.