Bootstrap Vue Range Component
Bootstrap Vue range component. Use our custom range inputs for consistent cross-browser styling and built-in customization.
Overview
Create custom <input type="range"> controls with <CFormRange>. The track (the background) and thumb (the value) are both styled to appear the same across browsers. As only Edge Legacy and Firefox supports "filling" their track from the left or right of the thumb as a means to visually indicate progress, we do not currently support it.
<CFormLabel for="customRange1">Example range</CFormLabel>
<CFormRange id="customRange1"/>
2
Disabled
Add the disabled boolean attribute on an input to give it a grayed out appearance and remove pointer events.
<CFormLabel for="disabledRange">Disabled range</CFormLabel>
<CFormRange id="disabledRange" disabled/>
2
Min and max
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.
<CFormLabel for="customRange2">Example range</CFormLabel>
<CFormRange :min="0" :max="5" value="3" id="customRange2"/>
2
Steps
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".
<CFormLabel for="customRange3">Example range</CFormLabel>
<CFormRange :min="0" :max="5" :step="0.5" value="3" id="customRange3"/>
2
API
CFormRange
import { CFormRange } from '@coreui/bootstrap-vue'
// or
import CFormRange from '@coreui/bootstrap-vue/src/components/form/CFormRange'
2
3
Props
| Prop name | Description | Type | Values | Default |
|---|---|---|---|---|
| disabled | Toggle the disabled state for the component. | boolean | - | - |
| max | Specifies the maximum value for the component. | number | - | - |
| min | Specifies the minimum value for the component. | number | - | - |
| model-value | The default name for a value passed using v-model. | string | - | |
| readonly | Toggle the readonly state for the component. | boolean | - | |
| steps | Specifies the interval between legal numbers in the component. | number | - | - |
| value | The value attribute of component.@controllable onChange | number | - | - |
Events
| Event name | Description | Properties |
|---|---|---|
| change | Event occurs when the value has been changed. | |
| update-model-value | Emit the new value whenever there’s a change event. |