Slider

Custom styling for range inputs

The is-slider modifier can be used to create a clean looking horizontal slider for the range input element.


<div class="is-slider">
  <input type="range">
</div>
Copy

The value attribute can be used to set the handle’s initial position. The handle will position directly in the middle of the slider if no default value is set. The min and max attributes will set the minimum and maximum permitted value for the slider. the defaults being 0 and 100.


<div class="is-slider">
  <input type="range" min="1" max="5" value="2">
</div>
Copy

Variables

The default styles can be overridden with the following variables. Set one or more of these variables before you import the framework.


VariableTypeDefault value
$slider-thumb-colorcolor$primary
$slider-thumb-radiusunits20px
$slider-thumb-heightunits1.5rem
$slider-thumb-widthunits1.5rem
$slider-track-heightunits8.4px
$slider-track-backgroundcolor#dbdbdb