Drag and drop
KanbanBoard
Track work by stage and move cards between named columns. The board supports pointer drag, keyboard drag, and direct controls on every card.
import '@reactloom/dnd/styles.css';
import { KanbanBoard } from '@reactloom/dnd';Examples
Supplier onboarding board
- Review supplier quote
- Approve contract
- Confirm delivery dates
No cards
import { useState } from 'react';
import { KanbanBoard, type KanbanCard } from '@reactloom/dnd';
const columns = [
{ id: 'ready', label: 'Ready' },
{ id: 'doing', label: 'In progress' },
{ id: 'done', label: 'Done' },
];
const initial: KanbanCard[] = [
{ id: 'quote', label: 'Review supplier quote', columnId: 'ready' },
{ id: 'contract', label: 'Approve contract', columnId: 'ready' },
{ id: 'dates', label: 'Confirm delivery dates', columnId: 'doing' },
];
export default function Example() {
const [cards, setCards] = useState(initial);
return <KanbanBoard label="Supplier onboarding" columns={columns} cards={cards} onChange={setCards} />;
}Read-only incident board
- Website latency
INC-102 · Platform
- Payment timeouts
INC-99 · Billing
import { KanbanBoard } from '@reactloom/dnd';
const columns = [
{ id: 'triage', label: 'Triage' },
{ id: 'fixed', label: 'Fixed' },
];
const incidents = [
{ id: 'INC-102', label: 'Website latency', owner: 'Platform', columnId: 'triage' },
{ id: 'INC-99', label: 'Payment timeouts', owner: 'Billing', columnId: 'fixed' },
];
export default function Example() {
return (
<KanbanBoard label="Incident snapshot" columns={columns} cards={incidents} onChange={() => {}} disabled
renderCard={(card) => <><strong>{card.label}</strong><br />{card.id} · {card.owner}</>} />
);
}API reference
| Prop | Type | Default |
|---|---|---|
labelrequiredNames the board. | string | — |
columnsrequiredOrdered columns with a stable id and accessible label. | readonly KanbanColumn[] | — |
cardsrequiredCards with unique id, label, and an existing columnId. Array order determines order inside each column. | readonly T[] | — |
onChangerequiredReceives the proposed order and column assignments. Update cards to commit the move. | (cards: T[]) => void | — |
renderCardRender custom card content while retaining built-in controls. | (card: T) => ReactNode | — |
disabledDisable all drag and move controls. | boolean | false |
messagesTranslate action labels, empty-column text, and move announcements. | Partial<KanbanMessages> | — |
Customization
Use className for board-scoped theme variables and renderCard for badges, dates, or other metadata. Use [data-drop-target] to style an active destination.
Accessibility
Each column is a named region. Drop on a card to insert before it, or on a column to append. Completed moves are announced with the new column and position.
| Key | Action |
|---|---|
| Tab | Move through drag handles, column selectors, and reorder buttons |
| Enter or Space on a handle | Start keyboard drag |
| Tab or Shift+Tab in drag mode | Choose a destination |
| Enter or Escape in drag mode | Drop or cancel |
Usage guidelines
Do
- Persist stable card and column IDs. Apply permission checks before committing moves.
Don’t
- Avoid duplicate column labels and avoid hiding the only control for changing a card’s stage.