|
6 | 6 | [](https://www.jsdelivr.com/package/gh/erimicel/stimulus-range-slider) |
7 | 7 | [](LICENSE) |
8 | 8 |
|
| 9 | +This component currently supports Numbers, Strings and only USD Currency number format. |
| 10 | +Also it comes with 2 value set options; |
| 11 | +`[1,2,3,4,5]` < as Array |
| 12 | +`1..5` < as Range |
| 13 | + |
9 | 14 | ## Live demo |
10 | 15 |
|
11 | 16 | https://erimicel.github.io/stimulus-range-slider/ |
@@ -44,6 +49,40 @@ To use `default` theme we also need to add css; |
44 | 49 | import 'stimulus-range-slider/dist/stimulus-range-slider.css'; |
45 | 50 | ``` |
46 | 51 |
|
| 52 | +Now we can add `range-slider` component to our view; |
| 53 | +```html |
| 54 | +<!-- Multi Range Slider with Tooltips --> |
| 55 | +<div data-controller="range-slider" |
| 56 | + data-range-slider-values-value="1..10" |
| 57 | + data-range-slider-labels-value="true" |
| 58 | + data-range-slider-tooltip-value="true"> |
| 59 | + <label class="block mb-8 text-sm font-medium text-gray-700 dark:text-white">Example of multi point range slider with tooltips</label> |
| 60 | + |
| 61 | + <input type="text" data-range-slider-target="inputMin" value="2"> |
| 62 | + <input type="text" data-range-slider-target="inputMax" value="5"> |
| 63 | + |
| 64 | + <!-- To show value on different element => <span data-range-slider-target="value"></span> --> |
| 65 | +</div> |
| 66 | + |
| 67 | +<!-- Single Range Slider --> |
| 68 | +<div data-controller="range-slider" |
| 69 | + data-range-slider-values-value="[1,5,10,15,20,25]"> |
| 70 | + <label class="block mb-2 text-sm font-medium text-gray-700 dark:text-white">Example of single range slider</label> |
| 71 | + |
| 72 | + <input type="text" data-range-slider-target="inputMin" value="5"> |
| 73 | +</div> |
| 74 | +``` |
| 75 | + |
| 76 | +Other data options; |
| 77 | +``` |
| 78 | +data-range-slider-values-value="[1,2,3,4,5]" |
| 79 | +data-range-slider-values-value='["red", "blue", "green"]' |
| 80 | +data-range-slider-step-value=5 |
| 81 | +data-range-slider-width-value="50%" |
| 82 | +data-range-slider-selected-colour-value="#ff0000" |
| 83 | +data-range-slider-currency-value="USD" |
| 84 | +``` |
| 85 | + |
47 | 86 | ## Development |
48 | 87 |
|
49 | 88 | To view examples locally, run `npm install && npm run build && npx serve` and then open `localhost:3000` in your browser. |
|
0 commit comments