Kanban <pm-kanban>
Kanban board: columns of cards that people move between stages, for a sales pipeline, tasks or hiring.
Overview
Give it columns and items; it draws the cards, so it works the same in every framework. Drag a card with the mouse, or press and hold it on a touch screen. With the keyboard: Space picks a card up, the arrow keys move it within and between columns, Space drops it and Escape puts it back; every step is announced. Enter or a click opens a card (pm-select). A move fires pm-move first: call preventDefault() to refuse it (then nothing changes), otherwise the board reorders itself and detail.items is the new list to save.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
columns | KanbanColumn[] | [] | The stages, in order: [{ id, title, tone?, limit? }]. |
items | KanbanItem[] | [] | The cards: [{ id, column, title, text?, tags?, assignee?, meta?, tone? }]. Their order is the order in each column. |
label | string | — | Accessible name of the board, e.g. "Sales pipeline". |
addable | boolean | false | Show an add button in each column header. |
disabled | boolean | false | Cards cannot be moved (they can still be opened). |
empty-textprop: emptyText | string | — | Text of a column without cards (default "No cards"). |
heading-levelprop: headingLevel | number | — | Heading level of the column titles, 1 to 6 (default 3). |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-move | onPmMove | A card was dropped in a new place (cancelable). |
pm-select | onPmSelect | A card was opened. |
pm-add | onPmAdd | The add button of a column was pressed (with addable). |
CSS parts
| Part | Description |
|---|---|
::part(base) | The scrolling row of columns. |
::part(column) | A column. |
::part(card) | A card. |
Methods
move()