Range inputs
Best practices
Range input controls allow users to select a specific range value from a larger, preset range. In some cases, users may also be able to input range values directly.
Wherever possible, range inputs should be avoided as they’re often difficult to manipulate. Especially on touch interfaces, the level of control needed to meticulously operate a slider to an exact value is simply not realistic.
Depending on the scenario, consider:
- Allowing users to select pre-set ranges using a radio group or dropdown.
- Allowing users to enter a range using text input fields.
- Allowing users to enter a specific value with clear instruction on what the value means.
In cases where a slider is used, ensure that users can select a range correctly without having to struggle to hit a precise value. Slider labels must be displayed above or beside the slider, rather than below it, in order to remain visible while the user is selecting a value.
How it works
Create custom <input type="range">
controls with .custom-range
. The track (the background) and thumb (the value) are both styled to appear the same across browsers. As only IE and Firefox support “filling” their track from the left or right of the thumb as a means to visually indicate progress, we do not currently support it.
Range inputs have implicit values for min
and max
—0
and 100
, respectively. You may specify new values for those using the min
and max
attributes.
By default, range inputs “snap” to integer values. To change this, you can specify a step
value. In the example below, we double the number of steps by using step="0.5"
.