Overview
Grab a card and it lifts off the board: it follows the pointer freely on both axes, leans into the direction you drag, and a dashed slot opens where it will land, with neighbours sliding out of the way. Release and the card flies into that slot before the real card takes its place, with a brief outline to mark where it landed. Esc (or a lost pointer) sends it back to where it started. The board auto-scrolls when you hold a card near its edges, column counts roll as cards come and go, and the arrow keys on a card's handle move it without a pointer.
Installation
Use the CLI to install the component automatically:
$ pnpm dlx shadcn@latest add https://ui.sanjid.in/r/kanban-board.jsonInstall dependencies:
$ pnpm add motion lucide-reactAdd the utility function for class merging:
lib/utils.ts
tsx
1import { ClassValue, clsx } from "clsx";2import { twMerge } from "tailwind-merge";3 4export function cn(...inputs: ClassValue[]) {5 return twMerge(clsx(inputs));6}
Copy the component code into your project:
tsx
1"use client";2 3import React, {4 useCallback,5 useEffect,6 useId,7 useRef,8 useState,9} from "react";10import { createPortal } from "react-dom";11import {12 AnimatePresence,13 LayoutGroup,14 animate,15 motion,16 useMotionValue,17 useReducedMotion,18 useSpring,19 useTransform,20 useVelocity,21 type MotionValue,22} from "motion/react";23import { GripVertical } from "lucide-react";24import { cn } from "@/lib/utils";25 26export type KanbanCard = {27 id: string;28 title: string;29 meta?: string;30 /** Small label shown above the title, e.g. a team or priority. */31 tag?: string;32};33 34export type KanbanColumn = {35 id: string;36 title: string;37 cards: KanbanCard[];38 /** Colour of the dot next to the column title. */39 accent?: string;40};41 42export type KanbanMove = {43 cardId: string;44 fromColumn: string;45 toColumn: string;46 index: number;47};48 49export type KanbanBoardProps = {50 /**51 * Columns. Without `onChange` this is the initial state and the board52 * manages moves itself. With `onChange` the board is controlled by this prop.53 */54 columns: KanbanColumn[];55 onChange?: (columns: KanbanColumn[]) => void;56 /** Fires once per completed move (pointer drop or keyboard). */57 onCardMove?: (move: KanbanMove) => void;58 className?: string;59};60 61type MoveDirection = "up" | "down" | "left" | "right";62 63type DragState = {64 card: KanbanCard;65 fromCol: string;66 fromIndex: number;67 overCol: string;68 overIndex: number;69 width: number;70 height: number;71 grabX: number;72 grabY: number;73 phase: "drag" | "drop";74};75 76type Pending = {77 card: KanbanCard;78 colId: string;79 index: number;80 startX: number;81 startY: number;82 rect: DOMRect;83};84 85const LAYOUT_SPRING = { type: "spring" as const, bounce: 0, duration: 0.3 };86const DROP_SPRING = { type: "spring" as const, bounce: 0.12, duration: 0.34 };87const DRAG_THRESHOLD = 4;88const EDGE = 48;89const DEFAULT_ACCENTS = ["#a1a1aa", "#f59e0b", "#3b82f6", "#10b981", "#a855f7"];90 91function cloneColumns(cols: KanbanColumn[]): KanbanColumn[] {92 return cols.map((c) => ({ ...c, cards: [...c.cards] }));93}94 95function findCard(cols: KanbanColumn[], cardId: string) {96 for (let i = 0; i < cols.length; i++) {97 const j = cols[i].cards.findIndex((c) => c.id === cardId);98 if (j >= 0) return { colIndex: i, cardIndex: j };99 }100 return null;101}102 103function moveCard(104 cols: KanbanColumn[],105 cardId: string,106 toCol: string,107 toIndex: number,108): KanbanColumn[] | null {109 const loc = findCard(cols, cardId);110 if (!loc) return null;111 const next = cloneColumns(cols);112 const [card] = next[loc.colIndex].cards.splice(loc.cardIndex, 1);113 const target = next.find((c) => c.id === toCol);114 if (!target || !card) return null;115 target.cards.splice(Math.min(toIndex, target.cards.length), 0, card);116 return next;117}118 119/* -------------------------------------------------------------------------- */120 121function CardFace({122 card,123 lifted = false,124 gripProps,125}: {126 card: KanbanCard;127 lifted?: boolean;128 gripProps?: React.ButtonHTMLAttributes<HTMLButtonElement> & {129 ref?: React.Ref<HTMLButtonElement>;130 };131}) {132 return (133 <div134 className={cn(135 "group/card relative flex items-start gap-1 rounded-[12px] bg-(--color-paper) py-2.5 pr-3 pl-1.5",136 "shadow-[inset_0_0_0_1px_var(--color-rule),0_1px_2px_rgba(0,0,0,0.04)]",137 lifted &&138 "shadow-[inset_0_0_0_1px_var(--color-rule),0_2px_4px_rgba(0,0,0,0.06),0_18px_40px_-12px_rgba(0,0,0,0.28)] dark:shadow-[inset_0_0_0_1px_var(--color-rule),0_18px_40px_-12px_rgba(0,0,0,0.7)]",139 )}140 >141 <button142 type="button"143 tabIndex={gripProps ? undefined : -1}144 aria-hidden={gripProps ? undefined : true}145 data-kanban-grip=""146 {...gripProps}147 className={cn(148 "flex size-7 shrink-0 touch-none items-center justify-center rounded-[8px] outline-none",149 "text-(--color-neutral) opacity-60 transition-[opacity,background-color,color,transform] duration-150",150 "group-hover/card:opacity-100 focus-visible:opacity-100 active:scale-[0.94]",151 "focus-visible:ring-2 focus-visible:ring-(--color-focus)",152 "[@media(hover:hover)]:hover:bg-(--color-paper-2) [@media(hover:hover)]:hover:text-(--color-ink)",153 "[@media(hover:none)]:opacity-100",154 lifted && "text-(--color-ink) opacity-100",155 )}156 >157 <GripVertical className="size-3.5" strokeWidth={1.75} aria-hidden />158 </button>159 <div className="min-w-0 flex-1 pt-[3px]">160 {card.tag ? (161 <div className="mb-1 inline-flex h-[18px] items-center rounded-full bg-(--color-paper-2) px-1.5 text-[10.5px] leading-none font-medium text-(--color-ink-2)">162 {card.tag}163 </div>164 ) : null}165 <div className="text-[13.5px] leading-snug font-medium text-pretty text-(--color-ink)">166 {card.title}167 </div>168 {card.meta ? (169 <div className="mt-1 text-[12px] leading-tight text-(--color-neutral)">170 {card.meta}171 </div>172 ) : null}173 </div>174 </div>175 );176}177 178function DragOverlay({179 drag,180 x,181 y,182 reduce,183}: {184 drag: DragState;185 x: MotionValue<number>;186 y: MotionValue<number>;187 reduce: boolean;188}) {189 // Lean into the direction of travel, like a card held by its corner.190 const vx = useVelocity(x);191 const tilt = useTransform(vx, [-1800, 0, 1800], [-7, 0, 7], { clamp: true });192 const rotate = useSpring(tilt, { stiffness: 420, damping: 32 });193 194 return createPortal(195 <motion.div196 aria-hidden197 style={{198 position: "fixed",199 left: 0,200 top: 0,201 zIndex: 90,202 width: drag.width,203 x,204 y,205 rotate: reduce ? 0 : rotate,206 transformOrigin: `${drag.grabX}px ${drag.grabY}px`,207 pointerEvents: "none",208 cursor: "grabbing",209 }}210 >211 <motion.div212 initial={{ scale: 1 }}213 animate={{ scale: reduce || drag.phase === "drop" ? 1 : 1.035 }}214 transition={{ type: "spring", bounce: 0, duration: 0.25 }}215 >216 <CardFace card={drag.card} lifted={drag.phase === "drag"} />217 </motion.div>218 </motion.div>,219 document.body,220 );221}222 223function CountBadge({ value, active }: { value: number; active: boolean }) {224 return (225 <span226 className={cn(227 "relative inline-flex h-5 min-w-5 items-center justify-center overflow-hidden rounded-full px-1.5",228 "text-[11px] leading-none font-medium tabular-nums transition-colors duration-200",229 active230 ? "bg-(--color-ink) text-(--color-paper)"231 : "bg-(--color-paper) text-(--color-neutral) shadow-[inset_0_0_0_1px_var(--color-rule)]",232 )}233 >234 <AnimatePresence initial={false} mode="popLayout">235 <motion.span236 key={value}237 initial={{ y: 8, opacity: 0, filter: "blur(2px)" }}238 animate={{ y: 0, opacity: 1, filter: "blur(0px)" }}239 exit={{ y: -8, opacity: 0, filter: "blur(2px)" }}240 transition={{ type: "spring", bounce: 0, duration: 0.3 }}241 >242 {value}243 </motion.span>244 </AnimatePresence>245 </span>246 );247}248 249/* -------------------------------------------------------------------------- */250 251export function KanbanBoard({252 columns: columnsProp,253 onChange,254 onCardMove,255 className,256}: KanbanBoardProps) {257 const reduce = !!useReducedMotion();258 const boardId = useId();259 const hintId = `${boardId}-hint`;260 // Uncontrolled: `columnsProp` only seeds state, like a defaultValue.261 const [internal, setInternal] = useState(columnsProp);262 const columns = onChange ? columnsProp : internal;263 264 const [drag, setDragState] = useState<DragState | null>(null);265 const [landed, setLanded] = useState<{ id: string; token: number } | null>(null);266 const [announcement, setAnnouncement] = useState("");267 268 const dragRef = useRef<DragState | null>(null);269 const pending = useRef<Pending | null>(null);270 const pointer = useRef({ x: 0, y: 0 });271 const columnsRef = useRef(columns);272 const pendingFocus = useRef<string | null>(null);273 const scrollerRef = useRef<HTMLDivElement>(null);274 const gripRefs = useRef(new Map<string, HTMLButtonElement>());275 const x = useMotionValue(0);276 const y = useMotionValue(0);277 278 useEffect(() => {279 columnsRef.current = columns;280 }, [columns]);281 282 const setDrag = useCallback((next: DragState | null) => {283 dragRef.current = next;284 setDragState(next);285 }, []);286 287 const commit = useCallback(288 (next: KanbanColumn[], move: KanbanMove) => {289 if (onChange) onChange(next);290 else setInternal(next);291 onCardMove?.(move);292 },293 [onChange, onCardMove],294 );295 296 // Keyboard moves remount or reorder the row; give focus back to its grip.297 useEffect(() => {298 const id = pendingFocus.current;299 if (!id) return;300 pendingFocus.current = null;301 gripRefs.current.get(id)?.focus();302 });303 304 /* ------------------------------ hit testing ----------------------------- */305 306 const hitTest = useCallback(() => {307 const d = dragRef.current;308 if (!d || d.phase !== "drag") return;309 const { x: px, y: py } = pointer.current;310 const colEl = document311 .elementsFromPoint(px, py)312 .find((el) => (el as HTMLElement).dataset?.kanbanCol) as HTMLElement | undefined;313 // Off the board the slot stays where it was, so a sloppy release still lands.314 if (!colEl || !colEl.closest(`[data-kanban-board="${boardId}"]`)) return;315 const colId = colEl.dataset.kanbanCol!;316 const list = colEl.querySelector<HTMLElement>("[data-kanban-list]");317 if (!list) return;318 319 // Compare the floating card's centre with each card's layout midpoint.320 // offsetTop ignores in-flight layout transforms, so the slot never jitters.321 const centre = py - d.grabY + d.height / 2 - list.getBoundingClientRect().top;322 const cards = list.querySelectorAll<HTMLElement>("[data-kanban-card]");323 let index = cards.length;324 for (let i = 0; i < cards.length; i++) {325 const el = cards[i];326 if (centre < el.offsetTop + el.offsetHeight / 2) {327 index = i;328 break;329 }330 }331 if (colId !== d.overCol || index !== d.overIndex) {332 setDrag({ ...d, overCol: colId, overIndex: index });333 }334 }, [boardId, setDrag]);335 336 /* ------------------------------ drag lifecycle -------------------------- */337 338 const startDrag = useCallback(339 (p: Pending) => {340 const { rect } = p;341 x.jump(rect.left);342 y.jump(rect.top);343 document.documentElement.style.cursor = "grabbing";344 document.documentElement.style.userSelect = "none";345 setDrag({346 card: p.card,347 fromCol: p.colId,348 fromIndex: p.index,349 overCol: p.colId,350 overIndex: p.index,351 width: rect.width,352 height: rect.height,353 grabX: p.startX - rect.left,354 grabY: p.startY - rect.top,355 phase: "drag",356 });357 },358 [setDrag, x, y],359 );360 361 const finish = useCallback(362 (accept: boolean) => {363 const d = dragRef.current;364 if (!d || d.phase !== "drag") return;365 document.documentElement.style.cursor = "";366 document.documentElement.style.userSelect = "";367 const target: DragState = accept368 ? { ...d, phase: "drop" }369 : { ...d, overCol: d.fromCol, overIndex: d.fromIndex, phase: "drop" };370 setDrag(target);371 372 // Wait one frame for the placeholder to take its final slot, then fly373 // the floating card into it before swapping in the real card.374 requestAnimationFrame(() => {375 const ph = document.querySelector<HTMLElement>(376 `[data-kanban-board="${boardId}"] [data-kanban-placeholder]`,377 );378 const list = ph?.offsetParent as HTMLElement | null;379 const done = () => {380 const moved =381 target.overCol !== target.fromCol || target.overIndex !== target.fromIndex;382 if (accept && moved) {383 const next = moveCard(384 columnsRef.current,385 target.card.id,386 target.overCol,387 target.overIndex,388 );389 if (next) {390 commit(next, {391 cardId: target.card.id,392 fromColumn: target.fromCol,393 toColumn: target.overCol,394 index: target.overIndex,395 });396 setLanded({ id: target.card.id, token: Date.now() });397 const col = next.find((c) => c.id === target.overCol);398 setAnnouncement(399 `${target.card.title} dropped in ${col?.title}, position ${target.overIndex + 1} of ${col?.cards.length}.`,400 );401 }402 }403 setDrag(null);404 };405 if (!ph || !list || reduce) return done();406 const box = list.getBoundingClientRect();407 Promise.all([408 animate(x, box.left + ph.offsetLeft, DROP_SPRING),409 animate(y, box.top + ph.offsetTop, DROP_SPRING),410 ]).then(done);411 });412 },413 [boardId, commit, reduce, setDrag, x, y],414 );415 416 useEffect(() => {417 const onMove = (e: PointerEvent) => {418 pointer.current = { x: e.clientX, y: e.clientY };419 const p = pending.current;420 if (p && !dragRef.current) {421 if (Math.hypot(e.clientX - p.startX, e.clientY - p.startY) < DRAG_THRESHOLD) return;422 pending.current = null;423 startDrag(p);424 }425 const d = dragRef.current;426 if (!d || d.phase !== "drag") return;427 x.set(e.clientX - d.grabX);428 y.set(e.clientY - d.grabY);429 hitTest();430 };431 const onUp = () => {432 pending.current = null;433 finish(true);434 };435 const onCancel = () => {436 pending.current = null;437 finish(false);438 };439 const onKey = (e: KeyboardEvent) => {440 if (e.key === "Escape" && dragRef.current?.phase === "drag") {441 e.preventDefault();442 finish(false);443 }444 };445 window.addEventListener("pointermove", onMove);446 window.addEventListener("pointerup", onUp);447 window.addEventListener("pointercancel", onCancel);448 window.addEventListener("keydown", onKey);449 return () => {450 window.removeEventListener("pointermove", onMove);451 window.removeEventListener("pointerup", onUp);452 window.removeEventListener("pointercancel", onCancel);453 window.removeEventListener("keydown", onKey);454 };455 }, [finish, hitTest, startDrag, x, y]);456 457 // Edge auto-scroll while a card is held near the board's sides.458 const dragging = drag?.phase === "drag";459 useEffect(() => {460 if (!dragging) return;461 let raf = 0;462 const tick = () => {463 const el = scrollerRef.current;464 if (el && el.scrollWidth > el.clientWidth) {465 const r = el.getBoundingClientRect();466 const px = pointer.current.x;467 const dx =468 px < r.left + EDGE469 ? -((r.left + EDGE - px) / EDGE) * 14470 : px > r.right - EDGE471 ? ((px - (r.right - EDGE)) / EDGE) * 14472 : 0;473 if (dx) {474 el.scrollLeft += dx;475 hitTest();476 }477 }478 raf = requestAnimationFrame(tick);479 };480 raf = requestAnimationFrame(tick);481 return () => cancelAnimationFrame(raf);482 }, [dragging, hitTest]);483 484 useEffect(485 () => () => {486 document.documentElement.style.cursor = "";487 document.documentElement.style.userSelect = "";488 },489 [],490 );491 492 const onCardPointerDown = (493 e: React.PointerEvent<HTMLDivElement>,494 card: KanbanCard,495 colId: string,496 index: number,497 ) => {498 if (!e.isPrimary || e.button !== 0 || dragRef.current) return;499 const target = e.target as Element;500 // Touch scrolls the page from the card body; the grip is the touch handle.501 if (e.pointerType === "touch" && !target.closest("[data-kanban-grip]")) return;502 if (e.pointerType === "mouse") e.preventDefault();503 pending.current = {504 card,505 colId,506 index,507 startX: e.clientX,508 startY: e.clientY,509 rect: e.currentTarget.getBoundingClientRect(),510 };511 };512 513 /* -------------------------------- keyboard ------------------------------ */514 515 const moveCardByKey = (cardId: string, direction: MoveDirection) => {516 const cols = columnsRef.current;517 const loc = findCard(cols, cardId);518 if (!loc) return;519 const from = cols[loc.colIndex];520 const card = from.cards[loc.cardIndex];521 let toCol = from;522 let toIndex = loc.cardIndex;523 524 if (direction === "up" || direction === "down") {525 toIndex += direction === "up" ? -1 : 1;526 if (toIndex < 0 || toIndex >= from.cards.length) return;527 } else {528 const neighbour = cols[loc.colIndex + (direction === "left" ? -1 : 1)];529 if (!neighbour) return;530 toCol = neighbour;531 toIndex = Math.min(loc.cardIndex, neighbour.cards.length);532 }533 534 const next = moveCard(cols, cardId, toCol.id, toIndex);535 if (!next) return;536 pendingFocus.current = cardId;537 commit(next, { cardId, fromColumn: from.id, toColumn: toCol.id, index: toIndex });538 const size = next.find((c) => c.id === toCol.id)?.cards.length ?? 0;539 setAnnouncement(540 toCol === from541 ? `${card.title} moved to position ${toIndex + 1} of ${size} in ${from.title}.`542 : `${card.title} moved to ${toCol.title}, position ${toIndex + 1} of ${size}.`,543 );544 };545 546 const keyToDirection: Record<string, MoveDirection> = {547 ArrowUp: "up",548 ArrowDown: "down",549 ArrowLeft: "left",550 ArrowRight: "right",551 };552 553 /* --------------------------------- render ------------------------------- */554 555 return (556 <LayoutGroup id={boardId}>557 <div id={hintId} className="sr-only">558 Drag a card by its handle, or focus the handle and use the arrow keys:559 Up and Down reorder within a column, Left and Right move the card to the560 neighbouring column.561 </div>562 <div563 ref={scrollerRef}564 data-kanban-board={boardId}565 className={cn(566 "flex items-stretch gap-3 overflow-x-auto pb-2 [scrollbar-width:thin]",567 className,568 )}569 >570 {columns.map((col, colIndex) => {571 const headingId = `${boardId}-col-${col.id}`;572 const isOver = !!drag && drag.overCol === col.id;573 const isForeignTarget = isOver && drag.fromCol !== col.id;574 const visible = drag575 ? col.cards.filter((c) => c.id !== drag.card.id)576 : col.cards;577 const count = visible.length + (isOver ? 1 : 0);578 const accent = col.accent ?? DEFAULT_ACCENTS[colIndex % DEFAULT_ACCENTS.length];579 580 const rows: React.ReactNode[] = visible.map((card, i) => {581 const flash = landed?.id === card.id;582 return (583 <motion.div584 key={card.id}585 layout={reduce ? false : "position"}586 transition={LAYOUT_SPRING}587 role="listitem"588 data-kanban-card=""589 onPointerDown={(e) => onCardPointerDown(e, card, col.id, i)}590 className="relative cursor-grab rounded-[12px] transition-transform duration-150 [@media(hover:hover)]:hover:-translate-y-px"591 >592 <CardFace593 card={card}594 gripProps={{595 ref: (el: HTMLButtonElement | null) => {596 if (el) gripRefs.current.set(card.id, el);597 else gripRefs.current.delete(card.id);598 },599 "aria-label": `Move ${card.title}`,600 "aria-describedby": hintId,601 onKeyDown: (e) => {602 const dir = keyToDirection[e.key];603 if (!dir) return;604 e.preventDefault();605 moveCardByKey(card.id, dir);606 },607 }}608 />609 {flash && !reduce ? (610 <motion.span611 key={landed.token}612 aria-hidden613 initial={{ opacity: 1 }}614 animate={{ opacity: 0 }}615 transition={{ duration: 0.9, ease: "easeOut" }}616 className="pointer-events-none absolute inset-0 rounded-[12px] shadow-[inset_0_0_0_1.5px_var(--color-ink)]"617 />618 ) : null}619 </motion.div>620 );621 });622 623 if (isOver) {624 rows.splice(625 Math.min(drag.overIndex, rows.length),626 0,627 <motion.div628 key="placeholder"629 layout={reduce ? false : "position"}630 transition={LAYOUT_SPRING}631 data-kanban-placeholder=""632 aria-hidden633 initial={false}634 className={cn(635 "rounded-[12px] border border-dashed",636 isForeignTarget637 ? "border-(--color-ink)/30 bg-(--color-ink)/[0.04]"638 : "border-(--color-rule) bg-(--color-paper)/50",639 )}640 style={{ height: drag.height }}641 />,642 );643 }644 645 return (646 <div647 key={col.id}648 role="group"649 aria-labelledby={headingId}650 data-kanban-col={col.id}651 className={cn(652 "flex w-64 shrink-0 flex-col rounded-[18px] p-2",653 "bg-(--color-paper-2) shadow-[inset_0_0_0_1px_transparent]",654 "transition-[box-shadow,background-color] duration-200 ease-out",655 isForeignTarget &&656 "bg-[color-mix(in_oklab,var(--color-ink)_5%,var(--color-paper-2))] shadow-[inset_0_0_0_1px_var(--color-rule)]",657 )}658 >659 <div className="mb-2 flex items-center gap-2 px-1.5 pt-1">660 <span661 aria-hidden662 className="size-2 shrink-0 rounded-full"663 style={{664 background: accent,665 boxShadow: `0 0 0 3px color-mix(in oklab, ${accent} 22%, transparent)`,666 }}667 />668 <div669 id={headingId}670 className="min-w-0 flex-1 truncate text-[13px] font-semibold text-(--color-ink)"671 >672 {col.title}673 </div>674 <CountBadge value={count} active={isForeignTarget} />675 </div>676 <div677 role="list"678 aria-labelledby={headingId}679 data-kanban-list=""680 className="relative flex min-h-[4.75rem] flex-1 flex-col gap-2"681 >682 {rows}683 {rows.length === 0 ? (684 <div className="flex h-[4.75rem] items-center justify-center rounded-[12px] border border-dashed border-(--color-rule) text-[12px] text-(--color-neutral)">685 No cards686 </div>687 ) : null}688 </div>689 </div>690 );691 })}692 </div>693 {drag ? <DragOverlay drag={drag} x={x} y={y} reduce={reduce} /> : null}694 <div role="status" aria-live="polite" className="sr-only">695 {announcement}696 </div>697 </LayoutGroup>698 );699}
Adjust import paths according to your folder structure.
Basic Usage
tsx
1import { KanbanBoard, type KanbanColumn } from "@/components/ui/kanban-board";2 3const [columns, setColumns] = useState<KanbanColumn[]>([4 { id: "todo", title: "Ready", accent: "#a1a1aa", cards: [{ id: "1", tag: "Billing", title: "Wire refund webhook", meta: "P1" }] },5 { id: "doing", title: "In progress", accent: "#f59e0b", cards: [] },6]);7 8<KanbanBoard9 columns={columns}10 onChange={setColumns}11 onCardMove={({ cardId, toColumn, index }) => save(cardId, toColumn, index)}12/>
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| columns | KanbanColumn[] | Yes | — | Columns with id, title, optional accent colour and cards ({ id, title, meta?, tag? }). Without onChange this is only the initial state. |
| onChange | (columns: KanbanColumn[]) => void | No | — | Makes the board controlled. Fires once per completed move with the new columns. |
| onCardMove | (move: { cardId, fromColumn, toColumn, index }) => void | No | — | Fires once per completed move, for pointer drops and keyboard moves. Handy for persisting a single change. |
| className | string | No | — | Class names on the scrolling board row. |
Best Practices
- With a mouse, grab a card anywhere; on touch, use the handle so the page can still scroll from the card body.
- Keyboard: focus a card's handle and use the arrow keys. Up and Down reorder within a column; Left and Right move it to the neighbouring column. Each move is announced.
- Persist from
onCardMovewhen your API stores single moves, or fromonChangewhen it stores the whole board. - Keep titles short and put status in
metaandtag; cards stay easy to scan while they move. - For a single list, use Reorder List instead.