Drag & Reorder
Pull to Refresh
A 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.
canvasmedium complexitymoderate motionpointermobile-ready
Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited
1
When to use it
Mobile-style refresh affordance demos, gesture UI previews, or loading-state illustrations on dark dashboards.
When not to
Contexts requiring real data refresh — the spinner is cosmetic only. Light backgrounds clash with the hardcoded dark theme.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change the release threshold to 80px by setting THRESH=80, swap the accent color to purple by changing CY='#a855f7', and increase row count to 7 by setting N=7 and extending rowLab. 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
- release threshold (THRESH=58)
- max pull distance (MAXP=92)
- row count (N=5) and rowLab array
- accent/spinner color (CY variable)
- spring stiffness and damping (k=180, c=22)
- refresh hold duration (refreshT>1.5)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- IIFE wrapper
- prefers-reduced-motion static-frame guard
- visibilitychange pause/resume
- pointer capture (setPointerCapture) for reliable drag tracking
- 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
- Light re-theme via the [data-theme=light] token block; catalog bg/accent describe the dark default
- Refresh action is cosmetic; no network hook or event emitted
- Row stagger lag (r*0.05 multiplier) becomes visually loose at N>8
- State remains local to each mounted instance; format/theme remount preserves takeover, not component values.
More Drag & Reorder components
- Kanban MoveThree-column kanban board where a cyan card lifts and spring-animates between lanes via FLIP. Idle demo stops after first input; supports arrow keys and…
- Sortable Grid3x3 grid of colored numbered tiles that spring-animate into position as tiles are dragged or swapped; initial idle shuffle stops after first input.
- Dual RangeCanvas dual-range slider with two spring-driven thumbs (white lo, amber hi), hatched fill, delta readout, and tick marks. Initial breathing stops after…
- 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.
- Drag Handle5 dark rows with grip handles spring-animate to new positions when dragged or arrow-keyed; the lifted row glows cyan and scales up slightly.
- Spring Physics StackPriority queue you reorder by dragging: the lifted row tilts with pointer velocity and neighbours spring into place.