react ~9 KB 0 deps v0.1.0 ↗ GitHub ↗

@mshafiqyajid/react-kanban

Headless kanban hook and styled component. HTML5 Drag and Drop API — no external DnD library. Columns, cards, inline card creation, custom renderers.

Playground #

To Do3
Design system tokens
Set up CI pipeline
Write onboarding docs
In Progress2
Component library
Docs site
Done1
Monorepo setup
Props
TSX
import { KanbanStyled } from "@mshafiqyajid/react-kanban/styled";
import "@mshafiqyajid/react-kanban/styles.css";

<KanbanStyled
  columns={columns}
  onChange={setColumns}
/>

Install #

npm install @mshafiqyajid/react-kanban

Quick start #

import { KanbanStyled } from "@mshafiqyajid/react-kanban/styled";
import type { KanbanColumn } from "@mshafiqyajid/react-kanban";
import "@mshafiqyajid/react-kanban/styles.css";

const [columns, setColumns] = useState<KanbanColumn[]>([
  { id: "todo",  title: "To Do",       cards: [] },
  { id: "doing", title: "In Progress", cards: [] },
  { id: "done",  title: "Done",        cards: [] },
]);

<KanbanStyled columns={columns} onChange={setColumns} tone="primary" />

API #

PropTypeDefaultDescription
columnsKanbanColumn[]Board columns with cards
onChange(cols) => voidCalled when columns/cards change
renderCard(card, col) => ReactNodeCustom card renderer
renderColumnHeader(col) => ReactNodeCustom column header
addCardPlaceholderstringShow an "add card" affordance with this placeholder text
columnMinWidthstring"240px"Minimum column width
maxColumnsnumberLimit the number of visible columns
size"sm" | "md" | "lg""md"Card and text size
tone"neutral" | "primary""neutral"Accent color
disabledbooleanfalseDisable drag and card creation
onCardAdd(card, columnId) => voidCard added callback
onCardRemove(card, columnId) => voidCard removed callback
onCardMove(card, from, to) => voidCard moved between columns callback
addColumnPlaceholderstringShows "+ Add column" button with this label
maxCardsPerColumnnumberPer-column card limit
cardDraggableboolean | (card, col) => booleantrueControl per-card drag
collapsiblebooleanfalseColumns can collapse
Edit this page on GitHub