cards
Array of card objects displayed on the board. Each card must have an id - the store throws "Kanban cards must have an id" when a card comes without one. All other fields are free-form and passed through to renderers, the editor, filters, and sort comparators.
A deadline value must be a Date object. Strings and timestamps aren't parsed, so convert them when loading the data. RestDataProvider converts them automatically.
columnAccessor sets which column a card belongs to (defaults to the column field).
Usage
cards: KanbanCard[];
type CardID = string | number;
interface KanbanCard {
id: CardID; // required
[key: string]: any;
}
| Field | Type | Description |
|---|---|---|
id | CardID (string | number) | Required. Unique card identifier |
[key: string] | any | Any additional fields - label, description, priority, progress, deadline (Date), tags, users, attachments, comments, css, etc. |
Example
import { Kanban } from "@svar-ui/react-kanban";
const columns = [
{ id: "backlog", label: "Backlog" },
{ id: "done", label: "Done" },
];
const cards = [
{ id: 1, label: "Fix login bug", column: "backlog", priority: 3 },
{ id: 2, label: "Write tests", column: "done", priority: 1 },
];
export default function App() {
return <Kanban cards={cards} columns={columns} />;
}
Related
- Cards guide - card data shape, sections, custom templates, and card actions
- columns - the column definitions that cards are distributed across
- columnAccessor - controls how cards map to columns
- add-card - add new cards to the board