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.

Very low
Very high
Select a value from low to high
<div class="form-group">
  <label for="customRange1">Example range</label>
  <div class="clearfix">
    <div class="float-left">
      Very low
    <div class="float-right">
      Very high
  <input type="range" class="custom-range" id="customRange1" aria-describedby="rangeHelpBlock">
  <small id="rangeHelpBlock" class="text-muted">
  Select a value from low to high

Range inputs have implicit values for min and max0 and 100, respectively. You may specify new values for those using the min and max attributes.

<label for="customRange2">Example range</label>
<input type="range" class="custom-range" min="0" max="5" id="customRange2">

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".

<label for="customRange3">Example range</label>
<input type="range" class="custom-range" min="0" max="5" step="0.5" id="customRange3">