Multi Range Slider
Vue Bootstrap 5 Multi Range Slide component
Vue slider is an interactive component that lets the user swiftly slide through possible values spread over a desired range. .
Note: Read the API tab to find all available options and advanced customization
Basic example
Multi-range Slider starts with max 100 and min 0 values.
<template>
<MDBMultiRange :thumb="false"></MDBMultiRange>
</template>
<script>
import { MDBMultiRange } from "mdb-vue-ui-kit";
export default {
components: {
MDBMultiRange
},
};
</script>
Basic example with values
You can show values in the another element in dom
<template>
<MDBMultiRange :thumb="false" v-model:firstValue="firstValue" v-model:secondValue="secondValue"></MDBMultiRange>
<div class="mt-3">
Value:
<span class="d-flex flex-column">
<div>First: {{ firstValue }}</div>
<div>Second: {{ secondValue }}</div>
</span>
</div>
</template>
<script>
import { MDBMultiRange } from "mdb-vue-ui-kit";
import { ref } from "vue";
export default {
components: {
MDBMultiRange
},
setup() {
const firstValue = ref(0);
const secondValue = ref(100);
return {
firstValue,
secondValue,
};
}
};
</script>
One range
You can set a one range to your slider with oneRange
property.
<template>
<MDBMultiRange :thumb="false" oneRange></MDBMultiRange>
</template>
<script>
import { MDBMultiRange } from "mdb-vue-ui-kit";
export default {
components: {
MDBMultiRange
},
};
</script>
Start Values
You can change start values to ranges with firstValue
and secondValue
properties. Or use
v-model
to get two-way binding.
<template>
<MDBMultiRange :thumb="false" v-model:firstValue="first" v-model:secondValue="second" @update:firstValue="handleChange"
@update:secondValue="handleChange"></MDBMultiRange>
<div class="mt-3">
Value:
<span class="d-flex flex-column">
<div v-if="active">First: {{ first }}</div>
<div v-if="active">Second: {{ second }}</div>
</span>
</div>
</template>
<script>
import { MDBMultiRange } from "mdb-vue-ui-kit";
import { ref } from "vue";
export default {
components: {
MDBMultiRange
},
setup() {
const first = ref(40);
const second = ref(80);
const active = ref(false);
const handleChange = () => (active.value = true);
return {
first,
second,
active,
handleChange,
};
}
};
</script>
Tooltips
You can set tooltip to ranges with thumb
property.
<template>
<MDBMultiRange></MDBMultiRange>
</template>
<script>
import { MDBMultiRange } from "mdb-vue-ui-kit";
export default {
components: {
MDBMultiRange
},
};
</script>
Step example
You can set a step to the ranges with step
attribute.
<template>
<MDBMultiRange :thumb="false" :step="5"></MDBMultiRange>
</template>
<script>
import { MDBMultiRange } from "mdb-vue-ui-kit";
export default {
components: {
MDBMultiRange
},
};
</script>
Multi Range Slider - API
Import
<script>
import {
MDBMultiRange
} from 'mdb-vue-ui-kit';
</script>
Properties
Property | Type | Default | Description |
---|---|---|---|
disabled
|
Boolean | false |
Disables input |
id
|
String | unique random id |
Changes input's id |
secondId
|
String | unique random id |
Changes second input's id |
inputClass
|
String | "" |
Adds input classes |
label
|
String | "" |
Changes input label |
labelClass
|
String | "" |
Adds input label classes |
max
|
Number | 100 |
Sets maximum value |
min
|
Number | 0 |
Sets minimum value |
step
|
Number | 1 |
Defines range step |
tag
|
String | "div" |
Changes input wrapper tag |
thumb
|
Boolean | true |
Enables or disables thumb. |
thumbClass
|
String | "" |
Adds thumb classes |
firstValue
|
Number | 0 |
Changes first input value |
secondValue
|
Number | 100 |
Changes second input value |
wrapperClass
|
String | "" |
Adds input wrapper classes |
oneRange
|
Boolean | false |
Displays only one range |
Events
Event Type | Description |
---|---|
update:firstValue
|
This event fires when the value of first input has been changed. |
update:secondValue
|
This event fires when the value of second input has been changed. |
start
|
This event fires when you start sliding thumb. |
end
|
This event fires when you stop sliding thumb. |
slide
|
This event fires when you use arrows to slide thumb. |