By · Updated

Dual Range Slider Builder

Two-Thumb Min and Max Slider for Price Filters, No Library Needed

No ratings yet

Values

Size

Colours

OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.

How the Dual Range Slider works

This dual range slider builder makes a two-thumb control from standard inputs. Price filters, date windows and "between" queries need two handles on one track. HTML has no dual range input, so this builder stacks two native sliders, paints the fill between them and adds a script that stops the handles crossing. Drag either thumb in the preview, then copy the code.

A dual range slider lets someone pick a span instead of a single value: a price band, a date window, an age range or a salary bracket. HTML has no native two-handle slider, so this generator builds one from two ordinary <input type="range"> elements stacked on one track, plus a few lines of CSS and script. You get the look you set on the left and copy-ready code that works without a framework.

Why it matters. Range filters are everywhere in e-commerce, property search, travel and job boards. Baymard Institute's usability testing of e-commerce filtering found that sliders alone frustrate users who want an exact number, and it recommends pairing them with text fields. A two-handle slider built on native inputs keeps the keyboard support, form submission and accessibility the browser already provides, which most JavaScript slider libraries have to recreate by hand.

How the dual range slider works

Reading the preview. The preview is the real component, not a picture of it. Drag each thumb, then Tab to a thumb and use the arrow keys, Page Up and Page Down, Home and End. The code panel always matches what you see, so you can test an edge case, such as a large step or a wide gap, before copying.

Choosing the settings

Tips and pitfalls.

For a single-value control, use the range slider generator. To show progress through a longer form, try the form progress bar.

FAQ

Why not use a library like noUiSlider?

Libraries add tooltips, pips, non-linear scales and touch refinements. If you need those they are worth the dependency. For a plain min/max filter, two native inputs give you keyboard and screen reader support for free with under thirty lines of script, and the values submit with the form.

Can I make the fill draggable to move both thumbs together?

Yes, but it needs pointer capture and some maths: on pointerdown over the fill, record the offset, then on pointermove shift both values by the same delta while respecting the ends. It is a nice touch for wide ranges but not something users expect, so it is left out here.

How do I show the values in bubbles above each thumb?

Position two spans absolutely over the track with left: var(--lo) and left: var(--hi), shifted by translateX(-50%). The custom properties already track the thumbs, so the bubbles follow with no extra script beyond setting their text.

Why does the track click do nothing?

Because both inputs ignore pointer events except on their thumbs. If you want track clicks to move the nearest thumb, add a pointerdown listener on the container, compute the clicked percentage, and set whichever input's value is closer. It is a few lines but an easy source of surprises.

Does this work with dates or non-numeric values?

Keep the inputs numeric and map. For dates, use days since a start date as the value and format the readout with Date. For a list of named steps, use the index as the value and look up the name. The slider only ever deals in numbers.

See also: all Forms & Inputs tools, Layout & Spacing, Shadows & Motion, Shapes & SVG, UI Components, Colour.

Related tools