Skip to content
VenusUI
Get started

Volume Knob

A synth-style knob you drag, scroll or use the keyboard to turn, with an LED ring.

Preview

Installation

npx shadcn@latest add @venusui/volume-knob

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/volume-knob.tsx

Usage

The code behind the preview above.

volume-knob-demo.tsx

import { VolumeKnob } from "@/components/ui/volume-knob"

export default function VolumeKnobDemo() {
  return (
    <div className="flex flex-wrap items-end justify-center gap-10">
      <VolumeKnob label="Volume" defaultValue={62} />
      <VolumeKnob label="Bass" defaultValue={0} min={-12} max={12} step={1} format={(v) => `${v > 0 ? "+" : ""}${v} dB`} />
    </div>
  )
}

API reference

PropTypeDefaultDescription
value, defaultValuenumber50Controlled or initial value.
onValueChange(value: number) => void—Called as it turns.
min, max, stepnumber0, 100, 1Range and step.
labelstring"Volume"Accessible name and caption.
format(value: number) => string—Formats the readout and the value read to screen readers, e.g. +3 dB.

All <div> props except onChange and defaultValue.

Requirements

  • React 19 and Tailwind CSS v4.

Customization

  • Drag sensitivity is DRAG_RANGE (pixels for the full range) in the file.

Accessibility

  • It's a slider with value text; arrow keys step, Page Up/Down jump a tenth, Home and End go to the ends.
  • Scrolling over it turns it without scrolling the page.

Troubleshooting

Dragging on a phone scrolls the page.
The knob uses touch-none; make sure a parent isn't capturing the touch first.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

A café dial for choosing a drink, with a cup that shows what goes into it.

Loading preview

A wall plate of rocker switches that light a row of pendant bulbs.

Loading preview

A graphic equalizer panel with faders, LED columns, a response curve and presets.