Press Space to lift. Use the arrow keys to move, Space to drop, Escape to cancel.
sortable-list · , lively
sortable-list-demo.tsx
When to use
Use to put one list of ten to forty items in order by hand. Rows can be locked or removed, the keyboard can reorder too, and an async save can throw a row back. Presets: rows, chips, cards.
Use it wherever people put things in order by hand: pipeline stages, the steps of an email sequence, subtasks, helpdesk views, macro actions, form fields, the parts of a bill of materials. One list, one axis, ten to forty rows. For cards across several columns use the kanban board; for the columns of a table, the column manager.
The motion follows the three beats. Pressing the grip charges: the row sinks 1.5%. Moving acts: a copy of the row lifts above the list, up to 2% larger (never more than 2 px on each side, so it stays inside the list's tile) on a tinted shadow and leaning up to 1.5° toward its travel, while the row itself stays behind as a hollow slot: an opaque, ring-tinted well with a dashed rim. The slot moves one position each time the lifted row's edge crosses a neighbour's midline (with 4 px of hysteresis, so it never jitters), and the neighbour shoves to the free side with a small squash along the axis. Releasing settles: the copy is thrown into the slot, the row sets down with a squash of its box (never its text), and the index balls, which never move, roll their digits together. While a row is in the hand every ball shows the committed number of the row beside it (the numbers travel with their rows); the drop rolls each changed ball from the old number to its new position, inside the ball, whose rim never moves. calm drops the lean and the put-down; the slot still travels and the neighbours still shove. The look never changes.
items are objects with an id and any fields you need; renderItem draws the middle of a row and renderMeta an optional trailing part (hidden under 360 px of list width in rows). The order is a list of ids: controlled (value + onValueChange) or uncontrolled (defaultValue). onValueChange fires once per drop, never mid-drag. onReorder({ id, from, to }) fires on every drop that changes the order; return a promise to save it on the server: the list shows the new order with aria-busy while the moved row's index ball breathes, and a rejection throws the row back to its old slot with one line under the list. A new lift waits until the save settles (move returns false meanwhile).
locked rows have no grip and never move: the slot skips them (Won and Lost at the end of a pipeline). disabled rows have no grip but neighbours can move around them. handle="row" makes the whole row the button. onRemove adds an × that sinks the row and closes its slot; onAdd adds an "Add" pill at the foot, and the item you add morphs out of it. apiRef gives move(id, to), which carries a row as a hand would (a "Move to top" menu item). labels translates every string, the announcements and the keyboard instructions included.
Pick a layout with preset: rows (default: 44 px tiles with index balls on a guide), chips (wrapping 32 px pills: column order, tag order; a chip that crosses a line fades in at its slot) or cards (72 px tiles for steps with an icon, a title and a meta line; the slot is a dashed card). size="sm" makes rows 36 px. Set the character app-wide with MotionKitProvider, or per list with temperament. Your own handlers on the root (onKeyDown, onPointerDown, ...) still fire, and ref points at it.
The chips preset in the table settings of a CRM: Name is locked first, every other column can be dragged along the wrapping row, and the line under the pills reads the resulting order.
DragDrag
Column order
Drag a column to move it in the contacts table. Name stays first.
Name
Company
Email
Phone
Owner
Stage
Last contact
City
Press Space to lift. Use the arrow keys to move, Space to drop, Escape to cancel.
Name · Company · Email · Phone · Owner · Stage · Last contact · City
The cards preset in an automation builder: four steps with an icon and a schedule line, an × to remove a step and an "Add step" pill that grows into the new card.
DragDrag
Onboarding sequence
Steps run top to bottom.
Welcome emailDay 0 · on sign-up
Three setup tipsDay 2 · 09:00
Book an onboarding callDay 4 · task for owner
Check-in emailDay 7 · 09:00
Press Space to lift. Use the arrow keys to move, Space to drop, Escape to cancel.
The list is an <ol role="list"> named by labels.list; each row is an <li>. The grip is a <button> named "Reorder Qualified, position 2 of 5", described by the keyboard instructions, with aria-pressed while the row is lifted. With handle="row" the row itself is that button.
A live region announces every step: "Qualified lifted, position 2 of 5", "Position 1 of 5", "Qualified dropped at position 1 of 5", "Reorder cancelled". It is assertive while a row is lifted and polite otherwise.
The index balls, the guide, the grip dots, the lock and the lifted copy are aria-hidden (the position is in the grip's name). Locked rows have no grip and say so with a lock.
The grip is 24 × 44 px (24 × 32 px on chips, WCAG 2.5.8). Touch: the grip lifts at once; a long press of 180 ms anywhere on the row lifts too, and the page stops scrolling while a row is lifted. A drag near the edge of the nearest scroll parent scrolls it.
Text is foreground and muted-foreground on background, AA in both themes; disabled lists keep full text contrast. Focus rings are ring-[3px] ring-ring/50 on every control.
With reduced motion (the OS setting, or MotionKitProvider reducedMotion="always") nothing leans, lifts, sinks or squashes, and the shadow does not change: the lifted row is marked by its ring-tinted rim. On release the row glides into its slot in the fade time, the neighbours move together, and the index digits crossfade instead of rolling. Every state is the same picture as the animated version's last frame.
Only transform and opacity animate: the lifted copy's position, lean and scale, the neighbours' Motion layout animations, the box squash and the digit strips. The Add morph sizes one small tile (the layout exception for one element) so its 1 px rim stays 1 px.
Row positions are read once per slot change (layout offsets, never inside the frame loop). The frame loop runs only while a row is in the hand and stops on release; nothing runs at rest. Long lists (more than 12 rows) reflow on the calm spring.
Our code is about 9 kB gzip. Third-party dependency, measured apart: motion (layout animations and springs), shared with every MotionKit component.
Technical sheet
Motion
calm
260 ms · bounce 0
lively
400 ms · bounce 0.3
playful
540 ms · bounce 0.45
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Size
Not measured yet · budget 15.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom, motion.
Dependencies
motion · peer
Triggers
drag, press, a keyboard shortcut, a value change
Reduced motion
No lean, no lift, no squash and no shadow change: the dragged row glides into its slot in the fade time, the neighbours move together and the index digits crossfade.
Keyboard
Tab
Moves to the next grip (or row with handle="row"); while lifted, drops the row where it is
Space / Enter on a grip
Lifts the row in place; pressed again, sets it down
ArrowUp / ArrowDown (ArrowLeft / ArrowRight for chips)
Moves the lifted row one slot, skipping locked rows
Home / End
Moves the lifted row to the first / last free slot
Escape
Sends the lifted row back home
Browsers
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)