0.1.13 • Published 3 years ago

dkn-range-slider v0.1.13

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

Published on webcomponents.org npm version

<dkn-range-slider>

Custom range-input based on web components API with zero dependencies (2.7kb gzipped). Some themes already included out-of-box in the packaged, but the slider has rich CSS styling API based on CSS custom-properties.

<dkn-range-slider></dkn-range-slider>

Check the live demo.

Installation

NPM

npm install dkn-range-slider

CDN

<script src="https://unpkg.com/dkn-range-slider@latest/dist/dkn-range-slider.min.js"></script>

Usage

When you include this script into your HTML page you can use web-components with custom tag.

<dkn-range-slider></dkn-range-slider>

API

Attributes and properties

AttributeReflected propertyTypeDefault valueDescription
namenamestringnullProxy attribute to inputtype=range. This name is passed to form data.
valuevaluenumber50Proxy attribute to inputtype=range value.
minminnumber0Proxy attribute to inputtype=range minimum.
maxmaxnumber0Proxy attribute to inputtype=range maximum.
stepstepnumber1Proxy attribute to inputtype=range step.
disableddisabledbooleanfalseProxy attribute to inputtype=range disabled. If enabled the value of range selector won't passed to form-data.
label-valuelabelValuebooleanfalseEnables label related with thumb, usually above thumb.
label-prefixlabelPrefixstring""Adds unit prefix for value's labels. Eg. $100, ¥100,
label-suffixlabelSuffixstring""Adds unit suffix for value's labels. Eg. 100M, 10cm.
label-limit-minlabelLimitMinstring""Labels for minimum label (usually on the left side).
label-limit-maxlabelLimitMaxstring""Labels for minimum label (usually on the right side).
label-accesslabelAccessstring""Labels for minimum label (usually on the right side).
ticksticksbooleanfalseEnables ticks.
ticks-stepticksStepnumber1Override step attribute only for ticks.

Styling

The styles are placed in CSS custom properties. If your requirements meets only default style you can do not include in your project any styles. By default there is fallback in web-components itself which has 'default' theme. Another option you can choose any theme provided with this project.

<link rel="stylesheet" href="minimal.css">

Custom styling

Custom styling is done by CSS custom properties. You can copy the default.css from src/ directory and set your own styles.

State of legacy Edge (<=79) and Internet Explorer

No support. Old IE11 and Edge don't support web-components and Shadow DOM natively. If you have proper skills and knowledge you can try to use polyfills.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.

Testing

Run the unit tests.

npm test

License

2020-2021 Dknight MIT.

0.1.13

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago