forever components

Drag & Reorder

Drag Handle

5 dark rows with grip handles spring-animate to new positions when dragged or arrow-keyed; the lifted row glows cyan and scales up slightly.

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

Settings panels, playlist editors, priority queues, or any sortable list needing tactile drag-to-reorder with keyboard accessibility.

When not to

Lists longer than ~10 items (absolute positioning covers full height). Touch-only contexts where pointer capture may conflict with scroll.

Working with an AI agent

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

Change accent color to purple (#a855f7), increase row height (ROWH) to 56, and add a 6th row by setting N=6 and extending the order array. 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 (--dr09-accent)
  • row count (N=5)
  • row height (ROWH=44)
  • spring stiffness (K=0.18) and damping (D=0.74)
  • demo idle timeout (3400ms)
  • bar widths (52+i*9)%
  • idle demo cadence (D_FIRST=300 / D_WAIT=1480 / D_LIFT=500 / D_REST=520 ms, resume IDLE_BACK=3400 ms)
  • theme tokens (:root dark defaults + [data-theme=light] overrides)

Keep intact

  • IIFE wrapper
  • prefers-reduced-motion static fallback
  • visibilitychange pause/resume
  • pointerCapture for reliable drag tracking
  • idle demo hop (the same move routine the drag/keyboard path uses; real input takes over)
  • theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)

Known limitations

  • Row count is fixed at build time — dynamic add/remove requires structural changes
  • Drag handle covers entire row, not just the grip icon — fine for demos but may conflict with row-level click handlers in production

drag-and-dropreorderlistspringgrip-handlekeyboardui-control

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