Skip to content
MIZU.

ReorderList

Rearrange a sequence while each item keeps its identity.

View .md

Live — this one is real

Release order

  • Verify typesCatch incompatible props
  • Run checksExercise behavior
  • Review the browserConfirm the real interaction

Drag a handle, use its arrow keys, or use the move buttons.

Usage

tsx
"use client";

import { useState } from "react";
import { ReorderList } from "mizu-ui";

export function Example() {
  const [items, setItems] = useState([
    { id: "a", label: "Verify types", description: "Catch incompatible props" },
    { id: "b", label: "Run checks", description: "Exercise behavior" },
    {
      id: "c",
      label: "Review the browser",
      description: "Confirm the real interaction",
    },
  ]);
  return (
    <ReorderList label="Release order" items={items} onReorder={setItems} />
  );
}

It starts with "use client" because it keeps state or passes functions to components, so it pastes into a Next.js page as it is. Other React setups ignore the directive.

Source & setup

Add this component to your project with the shadcn CLI. The command copies its source into your configured UI directory, with base.css, Mizu’s tokens, and the stylesheets that hold its rules. Each rule lives in one stylesheet, so components you add together never repeat CSS. In a project without a components.json, run npx shadcn@latest init 0xuser64bit/mizu/preset first: plain init installs shadcn’s theme into your global CSS. Then load the fonts.

sh
npx shadcn@latest add 0xuser64bit/mizu/reorder-list

Every component imports from its own path, its name in kebab case. To paste the example, replace its mizu-ui import with:

tsx
import { ReorderList } from "@/components/ui/mizu/reorder-list";

For npm imports, import mizu-ui/styles.css once. Fonts are optional via mizu-ui/fonts.css. Override --mizu-* tokens or use className for local styling. Requires React and Motion. A Client Component: its source starts with “use client”.

Inspect interaction/ReorderList.tsx

Source is included in the npm package under src/interaction/ReorderList.tsx.

Open full source ↗

Props

PropTypeDefaultDescription
itemsReorderEntry[]—Stable id, label and optional description.
onReorder(items: ReorderEntry[]) => void—Persist the new full ordering.
labelstring—Sequence name.

Accessibility

A real ordered sequence. Handles support pointer dragging and up/down keys; separate move buttons offer a touch-friendly alternative. Boundaries disable invalid moves.

Motion

Motion layout retains identity; reduced motion uses zero-duration settling.

Works alongside