Slider is a component to provide input with a drag handle.

import Slider from 'primevue/slider';

Two-way binding is defined using the standard v-model directive.

<Slider v-model="value" class="w-14rem" />

Slider is connected to an input field using two-way binding.

<InputText v-model.number="value" />
<Slider v-model="value" />

Size of each movement is defined with the step property.

<Slider v-model="value" :step="20" class="w-14rem" />

When range property is present, slider provides two handles to define two values. In range mode, value should be an array instead of a single value.

<Slider v-model="value" range class="w-14rem" />

Default layout of slider is horizontal, use orientation property for the alternative vertical mode.

<Slider v-model="value" orientation="vertical" class="h-14rem" />

Following is the list of structural style classes, for theming classes visit theming page.

p-sliderContainer element
p-slider-handleHandle element.

Screen Reader

Slider element component uses slider role on the handle in addition to the aria-orientation, aria-valuemin, aria-valuemax and aria-valuenow attributes. Value to describe the component can be defined using aria-labelledby and aria-label props.

<span id="label_number">Number</span>
<Slider aria-labelledby="label_number" />

<Slider aria-label="Number" />

Keyboard Support

tabMoves focus to the slider.
left arrowup arrowDecrements the value.
right arrowdown arrowIncrements the value.
homeSet the minimum value.
endSet the maximum value.
page upIncrements the value by 10 steps.
page downDecrements the value by 10 steps.