---
title: "Kanban"
description: "A board of columns where people drag cards from one stage to the next, by mouse, touch, or keys. A Move to menu does the same with no drag."
url: https://gelatinui.com/components/kanban
markdown_url: https://gelatinui.com/components/kanban.md
access: free
install: "npx shadcn@latest add @gelatin-ui/kanban"
registry_item: https://gelatinui.com/r/kanban.json
version: "2026-11-11"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Kanban

> A board of columns where people drag cards from one stage to the next, by mouse, touch, or keys. A Move to menu does the same with no drag.

Page: https://gelatinui.com/components/kanban

## When to use it

Best for: Work that moves through stages, where people drag cards between columns.

- Use it when the stage of a card is the main fact.
- Use `limit` on a column for a WIP limit.
- Use `selection` to move many cards at once.

## When not to use it

- To put one list in order, use a [Sortable List](https://gelatinui.com/components/sortable-list.md).
- To compare many fields per record, use a [Data Table](https://gelatinui.com/components/data-table.md).

## Notes for agents

- The value is a list of columns, each with `id` and `cards`: `[{ id: "todo", cards: ["a", "b"] }]`.
- `KanbanColumn value` and `KanbanCard value` must match the ids in that list.
- `onValueChange` runs live during a drag. Save in `onMove`, which runs once per finished move.
- Put cards in `KanbanColumnContent`. Read the ids of a column with `useKanbanColumn`.
- Drag on touch needs a 250ms press, so a swipe still scrolls.
- Set the column width with a class on `Kanban`: `[--kanban-column-width:240px]` (default `min(272px,85vw)`).
- Give `KanbanCard` and `KanbanColumn` a `label`: the Move to menu and the screen reader read it.
- `driverRef` drives a real drag from code (the `DragDriver` contract: `pickUp(at, card)`, `carry`, `drop`, `putBack`, in viewport px), for a staged scene, a tour, or a test.

## Anatomy

```text
Kanban
├─ KanbanColumnList (0..n)
├─ KanbanColumn (0..n)
├─ KanbanColumnHeader (0..n)
├─ KanbanColumnTitle (0..n)
├─ KanbanColumnName (0..n)
├─ KanbanColumnSummary (0..n)
├─ KanbanColumnActions (0..n)
├─ KanbanColumnAdd (0..n)
├─ KanbanColumnCollapse (0..n)
├─ KanbanColumnContent (0..n)
├─ KanbanColumnEmpty (0..n)
├─ KanbanColumnEmptyTitle (0..n)
├─ KanbanColumnEmptyDescription (0..n)
├─ KanbanCard (0..n)
│  └─ KanbanCardHandle (0..n)
├─ KanbanCardCover (0..n)
├─ KanbanCardLabel (0..n)
├─ KanbanCardMoveMenu (0..n)
├─ KanbanCardSkeleton (0..n)
├─ KanbanAddCard (0..n)
└─ KanbanAddColumn (0..n)
```

## API reference

### Kanban

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `KanbanValue` |  | The board: the columns in order, each with its card ids (controlled). |
| `defaultValue` | `KanbanValue` | EMPTY_BOARD | The first board when the Kanban owns the value (uncontrolled). |
| `onValueChange` | `function` |  | Called with each new board, to keep a controlled `value` in step: live during a drag when a card enters another column (React then moves the card, see `Kanban`), at the drop, after a Move to, and with the start board when a drag is canceled. |
| `onMove` | `function` |  | Called once per finished move (a drop, a Move to, a Move left), from where the item started to where it ended. Save to a server here, not in `onValueChange`. Not called for a cancel or a drop in the same place. |
| `selection` | `readonly string[]` |  | The selected card ids (controlled). Cmd or Ctrl + click or X toggles a card, Shift + click takes a range in a column, a plain click or Escape clears. Dragging a selected card moves every selected card; the Move to menu of a selected card moves them all too. |
| `defaultSelection` | `readonly string[]` | EMPTY_SELECTION | The first selection when the Kanban owns it (uncontrolled). |
| `onSelectionChange` | `function` |  | Called with each new selection, in board order. |
| `variant` | `"lane" \| "plain"` | "lane" | `lane` (default): each column on a soft lane. `plain`: no column fill. |
| `labels` | `Partial<KanbanLabels>` |  | The words of the board (the empty column, the buttons), merged over `KANBAN_LABELS`. |
| `driverRef` | `Ref<DragDriver<string> \| null>` |  | Drives a drag from code (`DragDriver`, a card id as the item): a staged scene, a tour, or a test lifts a card, carries it, and drops it through the same drag as a pointer, with the lift, the tilt, the move across columns, the drop flight, and the landed ring. |

### KanbanColumnList

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### KanbanColumn

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `string` |  | The column id: the `id` of one column in the board value. |
| `label` | `string` | id | The name shown in the Move to menu. Default: the id. |
| `icon` | `ReactNode` |  | The mark of the column in the Move to menu (a Status Icon). |
| `collapsed` | `boolean` |  | The column folds to a 44px strip (controlled). A collapsed column still takes a drop: the cards go to its end, and its count rolls. |
| `defaultCollapsed` | `boolean` | false |  |
| `onCollapsedChange` | `function` |  |  |
| `disabled` | `boolean` | false | The column cannot be dragged. Its cards still move. |

### KanbanColumnHeader

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### KanbanColumnTitle

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  | A mark (a Status Icon, 14px) and the `KanbanColumnName`. Loose text among the children is the name: the title puts it in a `KanbanColumnName` for you (`wrapLooseText`). |
| `count` | `boolean` | true | Show the card count (with the limit, as 3/4). Default `true`. |

### KanbanColumnName

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### KanbanColumnSummary

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `number` |  | The total of the column: points, money, hours. Count it from the column's cards. |
| `format` | `NumberFormatOptions` |  | The `Intl.NumberFormat` options of the number (`currency`, `compact`, fraction digits). |
| `locales` | `LocalesArgument` |  | The locale of the number. Default: the locale of the browser. |
| `unit` | `ReactNode` |  | A short unit after the number, as "pts". |

### KanbanColumnActions

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### KanbanColumnAdd

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### KanbanColumnCollapse

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### KanbanColumnContent

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### KanbanColumnEmpty

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### KanbanColumnEmptyTitle

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### KanbanColumnEmptyDescription

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### KanbanCard

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `string \| (readonly string[] & string)` |  | The card id: one id in its column's `cards`. |
| `label` | `string` |  | The name read on focus. Default: the id. |
| `disabled` | `boolean` |  | The card cannot be dragged (locked). It stays focusable. |

### KanbanCardHandle

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### KanbanCardCover

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `src` | `string` |  | The picture address. |

### KanbanCardLabel

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `color` | `string` |  | The label color: a data color (any CSS color, as the label colors of an app). It tints the label at 14% and fills the 6px dot; the text stays `foreground`, readable on every hue. |

### KanbanCardMoveMenu

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  | The label of the submenu trigger. Default: "Move to". |

### KanbanCardSkeleton

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `lines` | `1 \| 2` | 2 | The number of text lines under the id, 1 or 2. Default 2. |

### KanbanAddCard

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `onAdd` | `function` |  | Called with the trimmed title when the person adds a card. Make the card and its id here. |

### KanbanAddColumn

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `onAdd` | `function` |  | Called with the trimmed name. Add the column to the value here. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Kanban | `kanban` | `data-pointer-drag` | `--kanban-column-width` |  |
| KanbanColumnList | `kanban-column-list` |  |  |  |
| KanbanColumn | `kanban-column` | `data-collapsed`, `data-dnd-dragging`, `data-dnd-dropping`, `data-dnd-placeholder`, `data-folding`, `data-over`, `data-refused` | `--background`, `--foreground`, `--kanban-column-width`, `--motion-ease-out`, `--motion-fade`, `--motion-fade-exit`, `--motion-panel`, `--motion-press` | `motion-timing` |
| KanbanColumnHeader | `kanban-column-header` | `data-collapsed` |  |  |
| KanbanColumnTitle | `kanban-column-title` | `data-collapsed`, `data-refused` |  | `motion-timing`, `status-colors` |
| KanbanColumnName | `kanban-column-name` |  |  |  |
| KanbanColumnSummary | `kanban-column-summary` | `data-collapsed` |  |  |
| KanbanColumnActions | `kanban-column-actions` | `data-collapsed` |  | `hit-area` |
| KanbanColumnAdd | `kanban-column-add` |  |  |  |
| KanbanColumnCollapse | `kanban-column-collapse` |  |  |  |
| KanbanColumnContent | `kanban-column-content` | `data-collapsed` | `--kanban-column-width` | `status-colors` |
| KanbanColumnEmpty | `kanban-column-empty` |  |  |  |
| KanbanColumnEmptyTitle | `kanban-column-empty-title` |  |  |  |
| KanbanColumnEmptyDescription | `kanban-column-empty-description` |  |  |  |
| KanbanCard | `kanban-card` |  |  |  |
| KanbanCardHandle | `kanban-card-handle` |  |  | `hit-area`, `motion-timing` |
| KanbanCardCover | `kanban-card-cover` |  |  |  |
| KanbanCardLabel | `kanban-card-label` |  | `--kanban-label-color`, `--muted-foreground` |  |
| KanbanCardMoveMenu | `kanban-card-move-menu` |  |  |  |
| KanbanCardSkeleton | `kanban-card-skeleton` |  |  |  |
| KanbanAddCard | `kanban-add-card` | `data-collapsed` | `--kanban-column-width` |  |
| KanbanAddColumn | `kanban-add-column` |  | `--kanban-column-width` |  |

## Usage

Keep the board in state, and render a column per entry.

```tsx title="task-board.tsx"
import { useState } from "react";

import {
  Kanban,
  KanbanCard,
  KanbanColumn,
  KanbanColumnContent,
  KanbanColumnHeader,
  KanbanColumnList,
  KanbanColumnName,
  KanbanColumnTitle,
} from "@/components/data/kanban";
import type { KanbanValue } from "@/lib/kanban-board-model";

const start: KanbanValue = [
  { id: "To do", cards: ["Write the launch post"] },
  { id: "Done", cards: ["Ship dark mode"] },
];

export function TaskBoard() {
  const [board, setBoard] = useState(start);
  return (
    <Kanban value={board} onValueChange={setBoard}>
      <KanbanColumnList>
        {board.map((column) => {
          return (
            <KanbanColumn key={column.id} value={column.id} label={column.id}>
              <KanbanColumnHeader>
                <KanbanColumnTitle>
                  <KanbanColumnName>{column.id}</KanbanColumnName>
                </KanbanColumnTitle>
              </KanbanColumnHeader>
              <KanbanColumnContent>
                {column.cards.map((card) => {
                  return (
                    <KanbanCard key={card} value={card} label={card}>
                      {card}
                    </KanbanCard>
                  );
                })}
              </KanbanColumnContent>
            </KanbanColumn>
          );
        })}
      </KanbanColumnList>
    </Kanban>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/kanban
```

It adds 78 registry items: 74 files, 13505 lines, and the npm packages `@base-ui/react`, `@dnd-kit/abstract`, `@dnd-kit/dom`, `@dnd-kit/react`, `@mantine/hooks`, `@phosphor-icons/react`, `@unpic/core`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Image](https://gelatinui.com/components/image.md)
- [Input Group](https://gelatinui.com/components/input-group.md)
- [Kbd](https://gelatinui.com/components/kbd.md)
- [Menu](https://gelatinui.com/components/menu.md)
- [Rolling Number](https://gelatinui.com/components/rolling-number.md)
- [Skeleton](https://gelatinui.com/components/skeleton.md)
- [Textarea](https://gelatinui.com/components/textarea.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Sortable List](https://gelatinui.com/components/sortable-list.md): Pick Sortable List to put one list in order, with no columns.
- [Status Icon](https://gelatinui.com/components/status-icon.md)
- [Data Table](https://gelatinui.com/components/data-table.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Space | Lifts the focused card, and drops it. |
| Left Arrow, Right Arrow, Up Arrow, Down Arrow | Moves the lifted card. |
| Esc | Cancels the move, or clears the selection. |
| X | Adds the focused card to the selection. |

## Accessibility

Every move is also in the Move to menu of a card, with no drag.

A locked card (`disabled`) cannot move, and it keeps focus.

`KanbanCard` reads its `label` on focus.

## Motion

| Part | Motion |
| --- | --- |
| Lift | follow · spring, stiffness 500, damping 32 · the held card grows to 103% and tilts with the pointer speed |
| Drop | sheet · 300ms · ease-panel (0.2, 0.4, 0.2, 1) · the card settles back to its size in its new place |
| Move | panel · 260ms · ease-panel · cards close the gap after a Move to, an add, or a delete |
| Landed | fade-exit · the ring of a card that just landed holds for 600ms, then fades |
