Drag cards between columns with a line where they land, work-in-progress limits, a filter by person and quick add.
Installation
When to use
- Cards in columns you drag between, with work-in-progress limits, a filter by person and quick add.
- Task boards, sales pipelines, hiring and content calendars.
When not to use
- Long lists people sort and filter more than they move: Orders table or a Data Table.
- Work with more than six or so stages: the columns stop fitting; a table with a status filter.
Usage
Kanban board with your own data: every prop has the sample as its default, so pass only what you have.
"use client"
import { useState } from "react"
import { KanbanBoard, type KanbanTask } from "@/components/dashral/blocks/kanban-board"
export default function Board() {
const [tasks, setTasks] = useState<KanbanTask[]>([
{ id: "t1", title: "Design the pricing page", column: "todo", label: "Design", assignee: "olivia", due: "2026-11-20", comments: 2, subtasks: [1, 3] },
{ id: "t2", title: "Fix the login redirect", column: "doing", label: "Bug", assignee: "liam", due: "2026-11-12", comments: 0, subtasks: [0, 1] },
])
return (
<KanbanBoard
title="Sprint 14"
people={[
{ id: "olivia", name: "Olivia Martin" },
{ id: "liam", name: "Liam Johnson" },
]}
columns={[
{ id: "todo", title: "To do", dot: "bg-muted-foreground" },
{ id: "doing", title: "In progress", limit: 3, dot: "bg-info" },
{ id: "done", title: "Done", dot: "bg-success" },
]}
labels={{ Design: "highlight", Bug: "destructive" }}
tasks={tasks}
onMove={(id, column) => setTasks((list) => list.map((task) => (task.id === id ? { ...task, column } : task)))}
onAdd={(column, title) => {
const task = { id: crypto.randomUUID(), title, column, label: "Design", assignee: "olivia", due: "", comments: 0, subtasks: [0, 0] as [number, number] }
setTasks((list) => [...list, task])
return task
}}
onDelete={(id) => setTasks((list) => list.filter((task) => task.id !== id))}
/>
)
}API reference
KanbanBoard
A project board: four columns with counts and work-in-progress limits that warn when crossed. Drag a card to move or reorder it, with a line where it will land; every card's menu moves it too, for the keyboard and touch. Filter by person, and add a task at the bottom of any column. Your board comes from props (a new task list replaces what's shown), and every change goes to your handlers; one that throws is undone, with its message.
| Prop | Type | Default |
|---|---|---|
title | React.ReactNode | "Website relaunch" |
note | stringAfter the count of tasks done. | "launch on Nov 4" |
people | KanbanPerson[] | sample |
columns | KanbanColumn[] | sample |
labels | Record<string, LabelColor>Each label's badge color. | sample |
tasks | KanbanTask[] | sample |
today | DateFor due dates: overdue before it, soon within two days. | sample |
onMove | (id: string, column: string, before: string | null) => Promise<void> | voidA card moved: to this column, before this task (or at the end). | — |
onAdd | (column: string, title: string) => Promise<KanbanTask | void> | KanbanTask | voidA task added at the bottom of a column; return it as stored to show it so. | — |
onDelete | (id: string) => Promise<void> | void | — |
type KanbanPerson
| Prop | Type | Default |
|---|---|---|
id | string | — |
name | string | — |
src | string | — |
type KanbanColumn
A column: its title, a work-in-progress limit that warns when crossed, and its dot's color class. The last is "done".
| Prop | Type | Default |
|---|---|---|
id | string | — |
title | string | — |
limit | number | — |
dot | string | — |
type KanbanTask
| Prop | Type | Default |
|---|---|---|
id | string | — |
title | string | — |
column | ColumnId | — |
label | Label | — |
assignee | string | — |
due | string | — |
comments | number | — |
subtasks | [done: number, total: number] | — |