Drag & Reorder
Snap Slider
Ochre-accent range slider with 9 tick detents; thumb flicks with spring momentum and rubber-bands at ends. Self-demos on idle, accepts keyboard input.
cssmedium complexitymoderate motionpointer
Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited
Worth keeping?
Votes steer what gets built next — sign in to cast one, free to read
When to use it
Settings panels, volume/scrubber controls, or any stepped range input that benefits from tactile snap feedback and visible momentum.
When not to
Continuous (non-stepped) value inputs, or contexts where the auto-demo loop would confuse users — remove the demoStep timer before shipping.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change STEPS from 8 to 4, set accent color --ac to #BFA98C, and slow the spring by reducing K from 0.22 to 0.12. 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
- step count (STEPS=8)
- spring stiffness (K=0.22)
- spring damping (DMP=0.66)
- accent color (--ac:#A68D3F)
- thumb size (width/height 34px)
- idle demo interval (1400+random*700)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- IIFE wrapper
- visibilitychange stopLoop/startLoop
- prefers-reduced-motion static-frame guard
- setPointerCapture for reliable drag tracking
- theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
Known limitations
- Auto-demo loop runs by default — clear demoTO and set demoOn=false before production use
- Spring physics runs every rAF frame even when idle; pos/vel settle but loop never fully exits
More Drag & Reorder components
- FLIP Reorder7-row list reorders via FLIP spring physics on drag or arrow-key input; lifted card gains glow outline while others spring to new slots. Auto-demos when idle.
- Kanban MoveThree-column kanban board where a cyan card lifts and spring-animates between lanes via FLIP. Auto-demos on a timer; supports arrow keys and horizontal drag.
- Pull to RefreshA 5-row canvas list springs down on drag, revealing diagonal bars and a rotating geometric indicator; releasing past threshold triggers a 1.5s sync spinner.
- Sortable Grid3x3 grid of colored numbered tiles that spring-animate into position as tiles are dragged or swapped; auto-shuffles on idle as a demo.
- Dual RangeCanvas dual-range slider with two spring-driven thumbs (white lo, amber hi), hatched fill, delta readout, and tick marks. Auto-breathes when idle.
- Carousel ThrowSeven colored cards orbit a glowing hub in a radial ring; drag to fling with angular inertia, release to snap to the nearest card under the marker.