x
1
2
3
4
<div class="dual-range-input" data-controller="dual-range"> <input type="range" name="range_min_field" id="range_min_field" value="25" min="0" max="100" step="1" data-dual-range-target="min" /> <input type="range" name="range_max_field" id="range_max_field" value="75" min="0" max="100" step="1" data-dual-range-target="max" /></div>
1
2
3
4
<div class="dual-range-input" data-controller="dual-range"> <%= range_field_tag "range_min_field", 25, min: 0, max: 100, step: 1, data: { dual_range_target: "min" } %> <%= range_field_tag "range_max_field", 75, min: 0, max: 100, step: 1, data: { dual_range_target: "max" } %></div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@import url("https://esm.sh/@stanko/dual-range-input@1.0.0/dist/index.css");.range { accent-color: var(--color-primary);}.range:focus-visible { outline: var(--input-outline-size, 2px) solid var(--color-selected-dark);}.dual-range-input { /* Height of the input */ --dri-height: 1rem; /* Thumb size */ --dri-thumb-width: var(--dri-height); --dri-thumb-height: var(--dri-height); /* Thumb background color */ --dri-thumb-color: var(--color-primary); --dri-thumb-hover-color: var(--dri-thumb-color); --dri-thumb-active-color: var(--color-selected-dark); /* Thumb border */ --dri-thumb-border-color: var(--dri-thumb-color); --dri-thumb-border-hover-color: var(--dri-thumb-border-color); --dri-thumb-border-active-color: var(--dri-thumb-border-color); --dri-thumb-border-radius: 1rem; --dri-thumb-border-width: 1px; /* Track size */ --dri-track-height: calc(var(--dri-height) * .45); --dri-track-border-radius: 1rem; /* Track color */ --dri-track-color: var(--color-border); --dri-track-filled-color: var(--color-primary);}
Java Script is not required or multiple files are needed, check the notes.