forever components

Feedback & States

Slide to Confirm

Draggable pill slider fills green on full slide; early release triggers a red shake. Spring physics snap thumb back. Auto-demos with an occasional failure run.

cssmedium 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

High-stakes confirmations (transfers, deletes) where accidental taps must be prevented by deliberate drag intent.

When not to

Low-friction confirmations or mobile contexts needing a simple tap — the drag requirement adds intentional friction.

Working with an AI agent

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

Change the label to 'Delete account', set --ok to #ef4444, and raise the commit threshold from p>=0.96 to p>=0.99. 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

  • confirm threshold (p>=0.96)
  • label text ('Authorize transfer')
  • success color (--ok:#34d399)
  • error color (--err:#fb7185)
  • spring constants (k=0.16, damp=0.74)
  • auto-reset delay (confirmAt = now()+1300)
  • theme tokens (:root dark defaults + [data-theme=light] overrides)

Keep intact

  • IIFE wrapper
  • prefers-reduced-motion static fallback
  • visibilitychange pause/resume
  • aria role=slider + aria-live region
  • theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)

Known limitations

  • Auto-demo loops indefinitely — set demo=false and remove idleUntil resume block before shipping as real UI
  • Pointer capture on track element may feel slightly off during very fast drags off-element

sliderconfirmdragfeedbackui-controlspringaccessible

More Feedback & States components

  • Success CheckMint-green ring sweeps closed and a checkmark draws in with a springy pop and expanding halo; auto-replays and responds to click or spacebar.
  • Error ShakeDark email input shakes horizontally with decaying-sine, border flushes red, X icon pops in with overshoot spring, validation message slides up.
  • Toast StackDark notification toasts spring up from the bottom, drain a colored progress bar, then slide off right. Four types cycle: success, error, warning,…
  • Hold to ConfirmPress-and-hold fills a tick-marked ring; full hold rotates center square 45° into a green check; early release flashes red cross (cancelled).
  • Empty StateA Bauhaus open vessel sits empty while 26 mint motes drift in a slow orbital cloud above it; poking scatters them and they spring back to settle.
  • Like BurstHeart dips then spring-pops into a magenta-mint gradient, firing a 96-particle synthwave burst of dots and ring shards. Auto-cycles when idle.