∞ forever components

Inputs & Switches

Detent Knob

Knurled rotary knob snaps through 12 detents via a Hooke's-law spring; tick marks flash orange on land and a two-digit value readout counts up.

canvasheavy complexitymoderate motionclickmobile-ready

Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited

Live demo — the real component, running in a sandbox. One self-contained HTML file, zero dependencies. Open it on the canvas →
1

When to use it

Audio/synth UIs, settings panels, or any control demo needing a tactile rotary feel with discrete stepped values.

When not to

Contexts needing continuous value input or pointer-drag rotation rather than click-nudge stepping.

Working with an AI agent

Every component ships agent-ready metadata. An example instruction for this one:

Change STEPS to 8 for coarser detents, set ACC to '#00eaff' for a cyan accent, and increase K to 0.035 for a snappier spring. Theme: dark tokens live in :root, the light variant in :root[data-theme="light"]; ?theme=light or a {type:'forever:theme'} postMessage switches at runtime.

Safe to edit

  • detent count (STEPS=12)
  • accent color (ACC='#ff5c3a')
  • spring stiffness (K=0.020)
  • damping factor (DAMP=0.86)
  • knob size ratio (R=min(W,H)*0.30)
  • idle demo cadence (LEAD=18 / GAP=12 / BACK=108 / CYCLE=180, SWEEP=3 detents)
  • theme tokens (:root dark defaults + [data-theme=light] overrides)

Keep intact

  • DPR-aware canvas sizing
  • visibilitychange stop/start guards
  • prefers-reduced-motion snap fallback
  • idle demo sweep (same detent path as a real drag; real input takes over, demo stays off until reload)
  • theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
  • demo-v1 preview lifecycle: initialize demoEnabled from window.__foreverPreview and stop attract work on the window forever:interactive event; retain manual feedback, settling, cleanup and explicit sessions

Known limitations

  • Click nudges one detent at a time — no drag-to-rotate gesture
  • First deliberate input permanently disables idle demo; manual input, finite feedback and settling remain active. Host demoEnabled=false skips the initial attract cycle.
  • Value readout is index 0-11, not a mapped real-world range
  • State remains local to each mounted instance; format/theme remount preserves takeover, not component values.

knobrotarydetentspringcanvasui-controlreadout

More Inputs & Switches components

  • Liquid ToggleSVG liquid toggle with a goo filter, trailing droplets and a native button. First deliberate input stops the idle demo; the chosen on/off state settles fully.
  • Glow SliderSVG range slider with a muted plum-to-teal fill, glow and value bubble, driven by a native range input. First input stops demo oscillation; drag and…
  • Spring StepperMint stepper with native minus/plus buttons and a number reel that settles with spring feedback. First deliberate input stops automatic steps; the chosen…
  • Segmented ControlSlate-to-sage pill slides between four native segment buttons with elastic spring stretch. First input stops automatic cycling; committed selection remains.
  • Checkbox MorphThree native amber checkbox buttons animate their check strokes and expose pressed state. First input stops the demo; checked values remain.
  • Star RatingFive gold SVG star radio controls commit ratings on click or keyboard input and settle with a scale bounce. First input stops automatic sweeping.