forever components

Drag & Reorder

FLIP Reorder

7-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.

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

Drag-to-reorder UI demos, settings panels, task lists, or any sortable list needing tactile spring feedback.

When not to

Lists longer than ~12 items (fixed N); contexts requiring persistent state — order resets on reload.

Working with an AI agent

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

Change spring stiffness by setting k=0.28 and damp=0.65 for a snappier feel, and increase N to 9 rows with matching hues entries. 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

  • row count (N=7)
  • spring constants (k=0.16, damp=0.78)
  • color palette (hues array)
  • idle demo (DEMO_FIRST=28 / DEMO_GAP=132 / IDLE_BACK=216 frames @60fps; same FLIP path as a drop)
  • theme tokens (:root dark defaults + [data-theme=light] overrides)

Keep intact

  • IIFE wrapper
  • prefers-reduced-motion guard with static fallback
  • visibilitychange pause / resume
  • typed Float32Array physics buffers (cy, vy, ty)
  • theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)

Known limitations

  • Row count N is hardcoded — adding rows requires updating both N and the hues array
  • Order is not persisted; resets on page reload
  • aria-grabbed is deprecated in ARIA 1.2 — replace with aria-roledescription for production

dragreorderflipspringlistkeyboarddemo

More Drag & Reorder components

  • 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.
  • Snap SliderOchre-accent range slider with 9 tick detents; thumb flicks with spring momentum and rubber-bands at ends. Self-demos on idle, accepts keyboard input.
  • 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.