ReorderList

A list you reorder by its grip. Neighbours slide aside on a spring, and the keyboard works too: focus the grip, press arrow up or down. Moves are announced. Layout.

Open playground
  • Write the briefDue Monday
  • Block the layoutStatic first
  • Add the motionSprings, not tweens
  • Ship itAfter reduced motion

About

ReorderList is a React component in the Layout category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { ReorderList } from "@ashutoshswamy/smoui" and set items, onChange.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { ReorderList } from "@ashutoshswamy/smoui";

<ReorderList
  items={[{ id: "1", label: "Write the brief", description: "Due Monday" }]}
  onChange={(ids) => save(ids)}
/>

Props 2

items

Starting order.

{ id: string; label: ReactNode; description?: ReactNode }[]
onChange

The new order of ids after each move.

(ids: string[]) => void