motion-drag
/motion-drag
Drag, pan, and reorder: draggable elements with constraints/elastic/ momentum, drag controls, swipe-to-dismiss, bottom sheets, and ReorderGroup/ReorderItem lists and grids. Use for pointer-driven movement of elements in glimmer-motion / Choreo code in this repo (packages/glimmer-motion, packages/choreo, the Choreo gallery, host UI that animates with them) — including touch-action rules for mobile.
- Author
- cardstack ↗
- Repository
- boxel ↗
- Licence
- MIT
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Drag, pan, and reorder: draggable elements with constraints/elastic/ momentum, drag controls, swipe-to-dismiss, bottom sheets, and ReorderGroup/ReorderItem lists and grids. Use for pointer-driven movement of elements in glimmer-motion / Choreo code in this repo (packages/glimmer-motion, packages/choreo, the Choreo gallery, host UI that animates with them) — including touch-action rules for mobile.
Original author description
Drag, pan, and reorder: draggable elements with constraints/elastic/ momentum, drag controls, swipe-to-dismiss, bottom sheets, and ReorderGroup/ReorderItem lists and grids. Use for pointer-driven movement of elements in glimmer-motion / Choreo code in this repo (packages/glimmer-motion, packages/choreo, the Choreo gallery, host UI that animates with them) — including touch-action rules for mobile.
How it works
- Drag ({{motion drag=…}})
- Reorder
- Mobile rules (learned the hard way here)
- When NOT
SKILL.md preview
---
name: motion-drag
description: >-
Drag, pan, and reorder: draggable elements with constraints/elastic/
momentum, drag controls, swipe-to-dismiss, bottom sheets, and
ReorderGroup/ReorderItem lists and grids. Use for pointer-driven movement of
elements in glimmer-motion / Choreo code in this repo
(packages/glimmer-motion, packages/choreo, the Choreo gallery,
host UI that animates with them) — including touch-action rules for mobile.
---
# Drag and reorder
## Drag (`{{motion drag=…}}`)
Motion's own pan/drag session, inlined from framer-motion's build:
```gts
<div {{motion drag=true dragConstraints=this.container dragElastic=0.2}} />
```
- `drag`: `true` / `"x"` / `"y"`; `dragDirectionLock`, `dragPropagation`,
`dragListener`.
- `dragConstraints`: an object (`{ top, left, right, bottom }`), an element,
or a `{current}` ref; re-measured on resize. `dragElastic`,
`dragMomentum`, `dragTransition`, `dragSnapToOrigin`.
- `createDragControls()` + `dragControls=` for starting a drag from another
element (`snapToCursor`). `whileDrag` for the pressed style; `onDragStart`
/ `onDrag` / `onDragEnd` / `onDirectionLock`.
- Pan without displacement: `onPanStart` / `onPan` / `onPanEnd`.
- Rotated/scaled parents: `transformPagePoint` with
`correctParentTransform()`; SVG viewBox: `transformViewBoxPoint()`.
- Interactive children (inputs, selects, contenteditable) don't start a
drag; drag composes with `layout` / `layoutId` and works mid-scroll.
## Reorder
```gts
import { ReorderGroup, ReorderItem } from 'glimmer-motion';
<ReorderGroup
@values={{this.items}}
@onReorder={{this.setItems}}
@axis='y'
as |group|
>
{{#each this.items as |item|}}
<ReorderItem @group={{group}} @value={{item}}>{{item.label}}</ReorderItem>
{{/each}}
</ReorderGroup>
```
`@group` is required: it is the context `<ReorderGroup>` yields.
`ul`/`li` with `...attributes`; axis `"x"` / `"y"` / `"xy"` (wrapped lists),
detected from layout when omitted; auto-scrolls a scrollable ancestor near
its edges; works inside `<Presence>`.
## Mobile rules (learned the hard way here)
- `drag` sets `touch-action` on its element itself (`none` for `true`,
`pan-y` for `"x"`, `pan-x` for `"y"`, so a one-axis drag leaves the other
axis to the page). Any OTHER surface that owns a gesture — pan handlers, a
custom pointer stage (`.follow-stage`), the scrubbers — needs
`touch-action: none` in CSS, or the scroller steals the gesture on iOS.
- Buttons/controls get `touch-action: manipulation` to kill double-tap zoom.
- Hover-revealed controls don't exist on touch — provide a
`@media (hover: none)` always-visible fallback (the inbox delete button).
- A released drag that should return home reads best as an elastic spring
(`type: 'spring'`, `visualDuration`, some `bounce`) — see
`follow-pointer.gts`'s `release`.
## When NOT
Reordering triggered by _state_ (not a pointer) is a layout animation →
`motion-layout`. A drag that ends in a multi-element scene (drop → everyone
reflows in sequence) → hand the drop to `choreo-scene`.
Canonical demos, in `packages/choreo-gallery/realm/stages/`:
`drag.gts`, `sheet.gts`, `reorder.gts`,
`grid.gts`, `subdivision.gts`, `pointer.gts`.
Versions
The database has no other skills named motion-drag.
Database snapshot: 13.11.2026 · package version 3f6fada45444 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Similar skills
- 90motion-pattern
Choose the right animation pattern with glimmer-motion and Choreo (packages/glimmer-motion, packages/choreo, the Choreo gallery, and host UI that animates with them). Use FIRST whenever adding, changing, or reviewing an animation, transition, enter/exit, layout move, drag,… - 100motion-testing
Testing animated UI with glimmer-motion/test-support (setupMotion, animationsSettled, bounds, shape) and @cardstack/choreo/test-support (setupChoreo, orphanCount, strandedTransforms). Use when writing or debugging a test that renders motion elements, Presence, layout animation,… - 100gestures
Build drag, swipe, and sheet interactions that track the finger 1:1 and stay interruptible. Use when building or fixing anything the user drags, swipes, flings, holds, or dismisses with a gesture — drawers, sheets, swipe-to-dismiss toasts and cards, drag-to-reorder,… - 90fluid-interaction-review
Build or review gesture-driven web interactions such as drag, swipe, sheets, carousels, and draggable panels. Use when pointer tracking, interruption, velocity handoff, momentum projection, hysteresis, rubber-banding, spatial continuity, or motion/transparency/contrast fallbacks… - 100wp-admin-drag-and-drop
Build WordPress admin drag-and-drop UI with core's bundled jQuery UI Sortable, Draggable, Droppable, optional `jquery-touch-punch`, `wp-api-fetch`, and `wp-a11y.speak()`. Covers flat reorder lists, connected lists / kanban columns, palette-to-dropzone clones, hierarchical tree… - 100gestures
Build drag, swipe, and sheet interactions that track the finger 1:1 and stay interruptible. Use when building or fixing anything the user drags, swipes, flings, holds, or dismisses with a gesture — drawers, sheets, swipe-to-dismiss toasts and cards, drag-to-reorder,…