Back to components
ElementForm & InputFree

Knob React component

A rotary dial for picking a value in a range, like a mixer control: drag up or down, scroll or use the keyboard, with a 270° progress ring and a sliding thumb, or a physical-looking knob with an indicator and ticks that light up as it turns.

About the Knob component

Knob is a circular control for picking a value, like the volume or gain knobs on audio gear. It turns through 270 degrees, from the lower left round to the lower right, and the value springs smoothly to each new position. It comes in two looks: ring, a progress arc with a dot on the end and the value in the middle, and dial, a physical-looking knob with an indicator line, 21 tick marks that light up as it turns and the value underneath.

min, max and step set the range (0 to 100 by default), and value or defaultValue with onValueChange set and report it. unit adds a suffix such as % or dB, and format replaces the readout with your own text. size sets the diameter (128px by default), color the arc and indicator color, and label the caption under it. Dragging up turns it up, and 200px of travel covers the whole range.

When to use it

Use Knob in audio, video and creative tools, dashboards with dials, and settings panels where a compact circular control fits better than a long slider.

For precise numbers people will type, pair it with a number input or use a Slider instead.

Installation

Add the Knob component to your project with the shadcn CLI. It lands in components/knob.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add @reactframe/knob

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

More Form & Input components

Listbox
Free
Masked Input
Free
Toggle Button
Free
Input Group
Free
Button Group
Free
Floating Label Input
Free