forever components

Inputs & Switches

Slide Throw Lever

Draggable orange lever slides along a coil spring that snaps home with motion-blur ghost trails and a ringing track wobble on impact.

canvasmedium complexitymoderate motionpointer

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 →
Worth keeping? Votes steer what gets built next — sign in to cast one, free to read

When to use it

Game controls, industrial dashboards, or any UI needing a satisfying pull-and-release mechanical feel.

When not to

Precise binary toggles where snap-home physics could confuse state; also avoid in contexts requiring accessible keyboard control.

Working with an AI agent

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

Change the accent color from orange to electric blue by setting AC='#00eaff' and BG='#0a1020', then increase spring stiffness to 0.16 for a faster snap. 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

  • accent color (AC='#ff9e2c')
  • background color (BG='#2a0a18')
  • spring stiffness (STIFF=0.10)
  • spring damping (DAMP=0.62)
  • coil count (coils=9)
  • handle radius scale (S*0.085)
  • idle demo cadence (PULL_AT=18 / PULL=24 / HOLD=42 / CYCLE=180 / RESUME=216 frames, THROW=0.92)
  • theme tokens (:root dark defaults + [data-theme=light] overrides)

Keep intact

  • IIFE wrapper
  • prefers-reduced-motion guard with static fallback
  • visibilitychange pause/resume
  • DPR-aware canvas sizing
  • idle demo throw (same throw path as a drag; real input takes over)
  • theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)

Known limitations

  • Click auto-nudge only fires when pos<0.05 — users may not discover the interaction without a hint
  • No aria role or keyboard support — not accessible as an interactive control

leverspringdragcanvasphysicsmotion-blurindustrial-ui

More Inputs & Switches components

  • Liquid ToggleSVG toggle with a goo filter — the knob slides with trailing liquid droplets; track color fades between off and on states.
  • Glow SliderSVG range slider with a plum-to-teal gradient fill, glowing knob, and a floating value bubble that tracks the handle; auto-oscillates when idle.
  • Spring StepperMint-themed +/- stepper with a number reel that springs and overshoots between digits 0–9; auto-cycles as a demo. Dark green palette.
  • Segmented ControlSlate-to-sage gradient pill slides between Day/Week/Month/Year segments with elastic spring stretch. Auto-cycles; click pauses briefly.
  • Checkbox MorphThree amber rounded checkboxes auto-cycle and respond to clicks; the box fills and a checkmark strokes in via animated dashoffset.
  • Star RatingFive gold stars auto-sweep ratings up and down; the active star pops with a scale bounce. Pointer sets the hover rating instantly.