Range sliders are used for inputting numeric values within a range.
This component requires Javascript to render consistently between browsers.
To render a range slider, apply the class a-input
to an input type="range"
.
Range widths are fluid by default.
<div class="m-form__item">
<label class="a-label" for="range01">Range label</label>
<input class="a-input" type="range" id="range01">
</div>
<div class="m-form__item">
<label class="a-label" for="range02">Range label</label>
<input class="a-input" type="range" id="range02" disabled>
</div>
<div class="m-form__item">
<label class="a-label" for="range03">Range label</label>
<div class="m-input__wrapper -d--flex">
<span class="-text">200GB</span>
<input class="a-input -mx--2" type="range" id="range03">
<span class="-text">5TB</span>
</div>
</div>
As webkit browsers don't support an active track bar, we've created our own.
You will either need a JavaScript solution for moving the a-input__thumb
element and changing the size of a-input__progress
, or
you can use Chi's JavaScript library as it provides this functionality out of the box.
<div class="m-form__item">
<label class="a-label" for="range04">Range label</label>
<div class="m-input__wrapper">
<input class="a-input" type="range" id="range04">
<div class="a-input__progress"></div>
<div class="a-input__thumb"></div>
</div>
</div>
<div class="m-form__item">
<label class="a-label" for="range05">Range label</label>
<div class="m-input__wrapper">
<input class="a-input" type="range" id="range05" disabled>
<div class="a-input__progress"></div>
<div class="a-input__thumb"></div>
</div>
</div>
<div class="m-form__item">
<label class="a-label" for="range06">Range label</label>
<div class="m-input__wrapper -d--flex">
<span class="-text -mr--2">200GB</span>
<div class="m-input__wrapper -w--100">
<input class="a-input" type="range" id="range06">
<div class="a-input__progress"></div>
<div class="a-input__thumb"></div>
</div>
<span class="-text -ml--2">5TB</span>
</div>
</div>
Enable range sliders to function like radio buttons.
<div class="m-form__item">
<label class="a-label" for="range07">Range label</label>
<div class="m-input__wrapper">
<input class="a-input" type="range" min="0" max="4" step="1" id="range07">
<div class="a-input__tick-bar">
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">Monthly</div>
</div>
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">1 year</div>
</div>
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">2 years</div>
</div>
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">3 years</div>
</div>
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">> 3 years</div>
</div>
</div>
</div>
</div>
<div class="m-form__item">
<label class="a-label" for="range08">Range label</label>
<div class="m-input__wrapper">
<input class="a-input" type="range" min="0" max="4" step="1" id="range08" disabled>
<div class="a-input__tick-bar">
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">Monthly</div>
</div>
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">1 year</div>
</div>
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">2 years</div>
</div>
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">3 years</div>
</div>
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">> 3 years</div>
</div>
</div>
</div>
</div>
<div class="m-form__item">
<label class="a-label" for="range09">Range label</label>
<div class="m-input__wrapper">
<input class="a-input" type="range" min="0" max="4" step="1" id="range09">
<div class="a-input__tick-bar">
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">Monthly</div>
</div>
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">1 year</div>
</div>
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">2 years</div>
</div>
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">3 years</div>
</div>
<div>
<div class="a-input__tick"></div>
<div class="a-input__tick-label">> 3 years</div>
</div>
</div>
<div class="a-input__progress"></div>
<div class="a-input__thumb"></div>
</div>
</div>