Effort dial
Reasoning effort on a knob: it follows the pointer, settles into the nearest detent on a spring, lights an arc and rolls the level's name like a drum.
On this page
Turn the knob in the composer: it follows the pointer, settles into a detent, and the word under it rolls to the new level.
A knob says what a segmented control cannot: that effort is a quantity, more or less of the same thing. Turn it and it follows your pointer round its axis, the arc lighting to where it points; let go and a critically damped spring settles it into the nearest detent. The level's name rolls with the knob like a drum, so the word moves as much as the knob did.
Installation
Usage
import { EffortDial } from "@/components/ui/chatcn/effort-dial"
<EffortDial value={effort} onValueChange={setEffort} />Props
| Prop | Type | Notes |
|---|---|---|
options | { value, label, description? }[] | Default Low, Medium, High, Max |
value / defaultValue | string | Controlled or uncontrolled |
onValueChange | (value: string) => void | Fires as the knob passes each detent |
label | string | Shown above the value and used as the accessible name. Default "Effort" |
disabled | boolean |
Keyboard
| Key | Action |
|---|---|
ArrowRight / ArrowUp | Next level |
ArrowLeft / ArrowDown | Previous level |
Home / End | First or last level |
Accessibility
role="slider"with the level and its description asaria-valuetext.- Keys move it instantly: nothing a keyboard triggers animates.
- On phones each detent gives a 4 ms vibration where the browser supports it.
Motion
- One spring drives the knob angle, the lit arc and the drum, written straight to styles each frame, so React does not re-render during a turn.
- The dead zone at the bottom holds the end you came from, so the knob never flips across it.
Under reduced motion: the knob and drum jump to each detent.