# React Native Kanban Board with drag and drop (Pro)

> A React Native kanban board for iOS, Android and the web: drag cards between columns with the mouse or a finger, auto-scroll, WIP limits, tags, due dates, priority and assignees, plus an accessible Move to menu, screen-reader actions and keyboard moves. Zero native code.

# Kanban Pro

A board of columns and cards, as Trello, Linear and Jira draw it. Drag a card to another column or place: it lifts once the pointer moves a few points, so a tap still opens it, a placeholder shows where it will land, and the board scrolls sideways near its edges. On phones, where a swipe across the cards should scroll the board, `dragDelay={250}` makes a card wait for a long press instead. Dragging isn't the only way: each card has a Move to… menu, screen readers get Move up, down, left and right actions, and on the web Shift + arrow keys move the focused card. Every move is announced. All in React Native's own `PanResponder`, so it runs in Expo Go and the browser.

```tsx
import { Kanban } from '@patine-ui/pro';
```

```tsx live full
import { Kanban } from '@patine-ui/pro';

const inDays = (d) => new Date(Date.now() + d * 86400000);
const columns = [
  { id: 'todo', title: 'To do', color: 'textSecondary' },
  { id: 'doing', title: 'In progress', color: 'primary', limit: 3 },
  { id: 'review', title: 'In review', color: 'warning' },
  { id: 'done', title: 'Done', color: 'success' },
];
const start = [
  { id: 'c1', columnId: 'todo', title: 'Write the launch post', tags: [{ label: 'Marketing', color: '#8B5CF6' }], dueDate: inDays(3), priority: 'medium', assignees: [{ name: 'Maya Cohen' }] },
  { id: 'c2', columnId: 'todo', title: 'Audit color contrast', tags: [{ label: 'A11y', color: 'success' }], priority: 'low' },
  { id: 'c3', columnId: 'doing', title: 'Kanban drag and drop', description: 'Drag to move, auto-scroll near the edges.', dueDate: inDays(0), priority: 'high', assignees: [{ name: 'Omer Levi' }, { name: 'Dana Mizrahi' }] },
  { id: 'c4', columnId: 'review', title: 'Fix flaky date test', tags: [{ label: 'Bug', color: 'danger' }], dueDate: inDays(-1), priority: 'urgent' },
  { id: 'c5', columnId: 'done', title: 'Pricing table' },
];

export default function Example() {
  const [cards, setCards] = React.useState(start);
  return <Kanban columns={columns} cards={cards} onCardsChange={setCards} onAddCard={(column) => alert(`Add to ${column}`)} style={{ width: '100%' }} />;
}
```

## Example: a hiring pipeline

A recruiter's board: candidates move stage by stage, never skipping one, Offer holds at most two at a time, and each move is logged where a real app would save it.

```tsx live wide
import { useState } from 'react';
import { View } from 'react-native';
import { Text } from 'patine-ui';
import { Kanban } from '@patine-ui/pro';

const STAGES = [
  { id: 'applied', title: 'Applied' },
  { id: 'screen', title: 'Phone screen', color: 'primary' },
  { id: 'onsite', title: 'Interviews', color: 'warning' },
  { id: 'offer', title: 'Offer', color: 'success', limit: 2 },
];
const ORDER = STAGES.map((s) => s.id);
const START = [
  { id: 'p1', columnId: 'applied', title: 'Amara Okafor', description: 'Senior iOS · referred by Noah', tags: [{ label: 'Referral', color: 'success' }] },
  { id: 'p2', columnId: 'applied', title: 'Jonas Weber', description: 'Senior iOS' },
  { id: 'p3', columnId: 'screen', title: 'Mei Tanaka', description: 'Product designer', assignees: [{ name: 'Priya Shah' }] },
  { id: 'p4', columnId: 'onsite', title: 'Carlos Ruiz', description: 'Backend · panel on Thursday', assignees: [{ name: 'Omar Haddad' }, { name: 'Lena Novak' }] },
  { id: 'p5', columnId: 'offer', title: 'Sara Lindqvist', description: 'Data analyst · offer sent', tags: [{ label: 'Waiting', color: 'warning' }] },
];

export default function Example() {
  const [cards, setCards] = useState(START);
  const [log, setLog] = useState('Drag a candidate to the next stage.');
  return (
    <View style={{ width: '100%', gap: 8 }}>
      <Kanban
        columns={STAGES}
        cards={cards}
        onCardsChange={setCards}
        canMove={(card, to) => Math.abs(ORDER.indexOf(to) - ORDER.indexOf(card.columnId)) <= 1}
        onCardMove={({ card, to }) => setLog(`${card.title} → ${STAGES.find((s) => s.id === to.columnId)?.title}`)}
      />
      <Text size="sm" color="textSecondary">{log}</Text>
    </View>
  );
}
```

## Cards and columns

A column is `{ id, title, color?, limit? }`; with a `limit` its count reads "3 of 3", amber when full and red past it. A card is `{ id, columnId, title, description?, tags?, assignees?, dueDate?, priority?, cover?, locked?, data? }`. The order of `cards` is the order down each column. Due dates turn amber today and soon, red when overdue; `priority` shows a flag (`'low'`, `'medium'`, `'high'`, `'urgent'`).

## Moves

`onCardsChange(cards, move)` gets the new order after each user move: set it as `cards`, or use `defaultCards` and let the board keep its own. `onCardMove(move)` is the place to save: `{ card, from: { columnId, index }, to: { columnId, index } }`. `canMove(card, toColumnId)` refuses moves, such as into Done straight from To do; a `locked` card stays put.

```tsx live full
import { Kanban } from '@patine-ui/pro';

const columns = [
  { id: 'new', title: 'New' },
  { id: 'approved', title: 'Approved', color: 'primary' },
  { id: 'shipped', title: 'Shipped', color: 'success' },
];
const start = [
  { id: 'a', columnId: 'new', title: 'Order #1042' },
  { id: 'b', columnId: 'new', title: 'Order #1043', locked: true, description: 'Waiting for payment' },
  { id: 'c', columnId: 'approved', title: 'Order #1039' },
];

export default function Example() {
  const [cards, setCards] = React.useState(start);
  const [log, setLog] = React.useState('Move a card');
  return (
    <View style={{ gap: 12 }}>
      <Kanban
        columns={columns}
        cards={cards}
        onCardsChange={setCards}
        canMove={(card, to) => !(card.columnId === 'new' && to === 'shipped')}
        onCardMove={({ card, to }) => setLog(`${card.title} → ${to.columnId}, position ${to.index + 1}`)}
        columnWidth={240}
        density="compact"
        style={{ width: '100%' }}
      />
      <Text>{log}</Text>
    </View>
  );
}
```

## Your own cards

`renderCard({ card, index, column, dragging, theme })` draws a card's face; the board keeps its press, drag and menu. `renderColumnHeader` and `renderEmptyColumn` do the same for headers and empty columns. Put your own fields in `data`.

```tsx live full
import { Kanban } from '@patine-ui/pro';

const columns = [{ id: 'lead', title: 'Leads' }, { id: 'won', title: 'Won', color: 'success' }];
const deals = [
  { id: '1', columnId: 'lead', title: 'Acme Inc.', data: { amount: 12000 } },
  { id: '2', columnId: 'lead', title: 'Globex', data: { amount: 4800 } },
  { id: '3', columnId: 'won', title: 'Initech', data: { amount: 22000 } },
];

export default function Example() {
  return (
    <Kanban
      columns={columns}
      defaultCards={deals}
      showMoveMenu={false}
      renderCard={({ card }) => (
        <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
          <Text weight="medium">{card.title}</Text>
          <Text color="success" weight="semibold">${card.data.amount.toLocaleString()}</Text>
        </View>
      )}
      style={{ width: 600 }}
    />
  );
}
```

## Accessibility

Each card is read with its column, due date and priority, and hints that it can be held to drag. Dragging needs a finger or mouse, so every move it can make is also in the card's Move to… menu (a 44-point target in its corner) and in screen-reader actions; on the web, Shift + arrow keys move the focused card between columns and up and down. Moves are announced: "Moved to In review, position 1 of 2".

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `columns` | `KanbanColumn[]` | — | `{ id, title, color?, limit? }` |
| `cards` / `defaultCards` | `KanbanCard[]` | `[]` | `{ id, columnId, title, description?, tags?, assignees?, dueDate?, priority?, cover?, locked?, data? }` |
| `onCardsChange` | `(cards, move) => void` | — | Every user move, with the new order. |
| `onCardMove` | `(move) => void` | — | |
| `canMove` | `(card, toColumnId) => boolean` | always | |
| `onCardPress` | `(card) => void` | — | |
| `onAddCard` | `(columnId) => void` | — | Shows + on each column. |
| `draggable` | `boolean` | `true` | Cards can be dragged. |
| `dragDelay` | `number` | `0` | How long a card is held before it drags, in ms. With `0` it drags once the pointer moves a few points; set e.g. `250` so a swipe on a phone scrolls the board |
| `showMoveMenu` | `boolean` | `true` | |
| `columnWidth` | `number` | `280` | |
| `now` / `locale` | | | For due dates. |
| `renderCard` / `renderColumnHeader` / `renderEmptyColumn` | | | |
| `loading` / `error` / `onRetry` / `emptyTitle` / `renderEmpty` | | | States. |
| `density` / `labels` / `design` / `theme` / `accessibilityLabel` / `style` | | | |
