Precision dialNew
A small instrument for getting a value just right. Drag to tune; hold Shift for the finer details.
Install with the shadcn CLI
Overview
Give a continuous setting a little tactility. Fixed hairline ticks surround a rotating indicator, the readout follows each step directly, and the final number rolls into place when you release. Drag upwards to increase, downwards to decrease. Shift changes the sensitivity without jumping back to the starting value.
States
- tune
- The indicator follows the pointer without easing. Only its transform, the readout and accessible value change during movement.
- commit
- Release commits the snapped value. The final digits roll over 420ms; the dial stays where you left it.
- adjust
- Keyboard, preset and controlled changes rotate into position over 420ms. Home and End reach the limits.
- cancel
- Escape, focus loss, a hidden tab or pointer interruption restores the value from before the gesture.
Usage
Works with
Keep expensive updates off the gesture
Commit heavy work after release. The dial maintains its immediate visual feedback while you drag; onValueChange is available for consumers that need every snapped step.
Props
| Prop | Type | Description |
|---|---|---|
| label / unit | string | Accessible setting name and optional unit beside the readout. |
| value / defaultValue | numberdefault 50 | Controlled or initial value. Values clamp to the range and snap to step. |
| min / max / step | numberdefault 0 / 100 / 1 | Range and increment, with up to six decimal places. |
| onValueChange | (value: number) => void | Receives each distinct snapped value during a gesture. |
| onValueCommit | (value: number) => void | Receives a completed drag, keyboard adjustment or double-click reset. |
| disabled | booleandefault false | Disables input and cancels a gesture in progress. |
Accessibility and motion
- A native button exposes slider semantics, limits and the current value. Arrows change one step; Shift and arrows, Page Up and Page Down change ten.
- Dragging up increases the value; horizontal movement contributes at one quarter of the vertical sensitivity. Shift makes pointer movement ten times finer.
- Double-click resets to defaultValue. Cancellation does not call onValueCommit.
- The rotating face is a separate compositor layer. No layout measurement, React state update or animation loop runs per pointer move.
- Reduced motion keeps direct manipulation and removes the settling rotation and number roll.
Requirements
React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.
The CLI also installs Number roll.
Source
Registry item: /r/precision-dial.json