Knob is a form component to define number inputs with a dial.

import Knob from 'primevue/knob';

Knob is an input component and used with the standard v-model directive.


<Knob v-model="value" />

Boundaries are configured with the min and max values whose defaults are 0 and 100 respectively.


<Knob v-model="value" :min="-50" :max="50" />

Step factor is 1 by default and can be customized with step option.


<Knob v-model="value5" :step="10" />

The label can be customized with the valueTemplate property using either a template string or a function.


<Knob v-model="value" valueTemplate="{value}%" />

The border size is specified with the stroke property as a number in pixels.


<Knob v-model="value" :strokeWidth="5" />

Diameter of the knob is defined in pixels using the size property.


<Knob v-model="value" :size="200" />

valueColor defines the value color, rangeColor defines the range background and similarly textColor configures the color of the value text. In addition, strokeWidth is used to determine the width of the stroke of range and value sections.


<Knob v-model="value" valueColor="SlateGray" rangeColor="MediumTurquoise" />

Knob can be controlled with custom controls as well.


<Knob v-model="value" :size="150" readonly />
<div class="flex gap-2">
    <Button icon="pi pi-plus" @click="value++" :disabled="value >= 100" />
    <Button icon="pi pi-minus" @click="value--" :disabled="value <= 0" />

When readonly present, value cannot be edited.


<Knob v-model="value" readonly />

When disabled is present, a visual hint is applied to indicate that the Knob cannot be interacted with.


<Knob v-model="value" disabled />

Screen Reader

Knob element component uses slider role in addition to the 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>
<Knob aria-labelledby="label_number" />

<Knob aria-label="Number" />

Keyboard Support

tabMoves focus to the slider.
left arrowdown arrowDecrements the value.
right arrowup 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.