Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ondras/custom-range

A stylable replacement for <input type=range>
https://github.com/ondras/custom-range

custom-elements

Last synced: about 2 months ago
JSON representation

A stylable replacement for <input type=range>

Awesome Lists containing this project

README

        

#

This is a [Custom Element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) that mimics the native `` in a more styling-friendly way. It aims to offer the same HTML/JS API.

## Usage

Simply declare `` within your HTML markup. You also need to include a script file (`range.js`) and a stylesheet file (`range.css`). Possible approaches include [cloning the project](https://github.com/ondras/x-range.git), using [npm](https://www.npmjs.com/package/custom-range) or linking via CDN.

```html


```

There is a [sample fiddle](https://jsfiddle.net/ondras/o1kpw6jy/) available.

## Browser support

No idea.

## Styling

Mostly via [CSS Custom Properties](https://developer.mozilla.org/en-US/docs/Web/CSS/--*). Here are the defaults:

```css
x-range {
--thumb-size: 8px;
--thumb-color: #fff;
--thumb-shadow: #000;
--thumb-hover-color: #ddd;

--track-size: 4px;
--track-color: #888;
--track-shadow: #000;

--elapsed-color: #ddd;

--remaining-color: transparent;
}
```