Directory

← Back

ip-range

A simple wrapper around <input type='range' /> HTML5 Element.

Author

Rating

Popularity

<100

IP Slider

Built With Stencil Published on webcomponents.org

A simple wrapper around <input type="range" /> HTML5 Element.

The range input itself has browser support about like: Firefox 23+, Safari 4+, iOS 5+, Chrome 6+, Opera 11+, IE 10+, Android 4.2+. So pretty good. This custom component should largely match that.

Inspired by CSS-TRICKS.

ip slider example

Install

Script tag

  • Put a script tag <script src='https://unpkg.com/ip-slider@0.0.1/dist/ip-slider.js'></script> in the head of your index.html
  • Then you can use the <ip-slider></ip-slider> element anywhere in your template, JSX, html etc

Node Modules

  • Run npm install ip-slider --save
  • Put a script tag similar to this <script src='node_modules/ip-slider/dist/ip-slider.js'></script> in the head of your index.html
  • Then you can use the <ip-slider></ip-slider> element anywhere in your template, JSX, html etc

In a Stencil app

  • Run npm install ip-slider --save
  • Add an import to the npm packages import 'ip-slider';
  • Then you can use the <ip-slider></ip-slider> element anywhere in your template, JSX, html etc

Using

Include ip-slider element in you page:

<ip-slider value="0" min="0" max="0" step="1"></ip-slider>

Add disabled attribute in order to disable.

You can get the value listening oninput event:

<ip-slider value="10" oninput="yourFunction(event)"></ip-slider>

This event is a CustomEvent:

function yourFunction(event) {
  console.log(event.detail.value);
}

To get the real event from input, get srcEvent:

function yourFunction(event) {
  console.log(event.detail.srcEvent);
}

Another option to get data:

const ipSlider = document.querySelector('ip-slider');

console.log(ipSlider.value);
console.log(ipSlider.min);
console.log(ipSlider.max);
console.log(ipSlider.step);
console.log(ipSlider.disabled);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Dependencies

Released
2018-10-18
Maturity
IMPORTED
License
MIT License

Compatibility

Framework
Browser
Browser Independent

ip-range - Vaadin Add-on Directory

A simple wrapper around HTML5 Element. ip-range - Vaadin Add-on Directory
# IP Slider ![Built With Stencil](https://img.shields.io/badge/-Built%20With%20Stencil-16161d.svg?logo=data%3Aimage%2Fs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) [![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/ip-slider) A simple wrapper around `` HTML5 Element. The range input itself has browser support about like: Firefox 23+, Safari 4+, iOS 5+, Chrome 6+, Opera 11+, IE 10+, Android 4.2+. So pretty good. This custom component should largely match that. Inspired by [CSS-TRICKS](https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/). ![ip slider example](https://image.ibb.co/iSZ1O0/ip-slider-ex.gif) ## Install ### Script tag - Put a script tag `` in the head of your index.html - Then you can use the `` element anywhere in your template, JSX, html etc ### Node Modules - Run `npm install ip-slider --save` - Put a script tag similar to this `` in the head of your index.html - Then you can use the `` element anywhere in your template, JSX, html etc ### In a Stencil app - Run `npm install ip-slider --save` - Add an import to the npm packages `import 'ip-slider';` - Then you can use the `` element anywhere in your template, JSX, html etc ## Using Include `ip-slider` element in you page: ```html ``` Add `disabled` attribute in order to disable. You can get the **value** listening **oninput** event: ```html ``` This **event** is a **CustomEvent**: ```js function yourFunction(event) { console.log(event.detail.value); } ``` To get the real event from input, get `srcEvent`: ```js function yourFunction(event) { console.log(event.detail.srcEvent); } ``` Another option to get data: ```js const ipSlider = document.querySelector('ip-slider'); console.log(ipSlider.value); console.log(ipSlider.min); console.log(ipSlider.max); console.log(ipSlider.step); console.log(ipSlider.disabled); ```
Online