Introducing PrimeReact v11-alpha 🎉Discover Now
styledForm

Knob

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

48
Volume
75
Treble
24
Bass
preview

Usage#

import { Knob } from '@primereact/ui/knob';
<Knob.Root>
    <Knob.Range />
    <Knob.Value />
    <Knob.Text />
</Knob.Root>

Examples#

Basic#

A circular knob for selecting a numeric value within a defined range.

50
basic-demo

Min/Max#

Boundaries are configured with the min and max properties. Defaults are 0 and 100.

10
min-max-demo

Step#

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

50
step-demo

Template#

Use Knob.Text with a render function to customize displayed content.

50%
template-demo

Stroke#

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

40
stroke-demo

Size#

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

60
size-demo

Color#

Each of the three components (Knob.Range, Knob.Value, Knob.Text) accepts a color prop to customize appearance. In addition, strokeWidth determines the stroke width of range and value sections.

50
color-demo

Reactive#

Knob can be controlled with custom controls as well.

0
reactive-demo

ReadOnly#

When readOnly is present, value cannot be edited.

50
read-only-demo

Disabled#

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

50
disabled-demo

API#

Sub-Components#

See Knob Primitive for the full sub-component API.

Hooks#

See useKnob for the headless hook API.

Accessibility#

See Knob Primitive for WAI-ARIA compliance details and keyboard support.