API REFERENCE · DATA DISPLAY
<dj-board>
A Kanban board over plain records.
Cards are the records in data. Lanes are the values of one field, named by group-by. Within a lane, cards keep their order in data.
npm install @dojo-ng/board
import "@dojo-ng/board";
Moving cards
- The board is controlled: it never changes
data. Every move emitsdj-card-move, and your app applies it and assigns the new array. The exportedapplyCardMovedoes that in one line. - When the new data arrives, focus follows the moved card and the move is announced to assistive technology.
- Cards move with the move menu or the keyboard. Set
draggableto also allow pointer and touch drag between lanes. Drag is an extra: the menu and the keyboard stay available, so dragging is never the only way to move a card.
Lanes and cards
- Set
lanesexplicitly when you can. It fixes the lane order, gives each lane a label, and shows empty lanes. Without it, lanes come from the values found indata. renderCardsupplies the card content. The board draws it inside its own accessible card shell, so a custom card cannot break accessibility. WithoutrenderCard, each card is adj-cardshowing thecard-titlefield.- Work-in-progress limits are advisory: the lane shows a count such as
3/5and gets a style hook when it is over the limit, but moves are never blocked.
Keyboard
The board is one tab stop.
- The arrow keys move between cards and lanes; Home and End move within a lane.
- Enter activates the card.
- Space or M opens the move menu.
- Ctrl+arrow (Cmd+arrow on a Mac) moves the card itself.
Properties
| Property | Attribute | Type | Default |
|---|---|---|---|
dataThe cards (plain records). Lane order = order of appearance. Set in JavaScript. |
Property only | Card[] |
[] |
lanesLane definitions in display order. Empty → lanes derive from distinct group-by values in data order (explicit lanes recommended). Set in JavaScript. |
Property only | BoardLane[] |
[] |
groupByField that assigns a card to a lane (compared as a string). |
group-by |
string |
"status" |
cardKeyField giving a card's stable identity (must be unique across data). |
card-key |
string |
"id" |
cardTitleField used for the default card content, the card's accessible name, and announcements. |
card-title |
string |
"title" |
labelAccessible name for the board. |
label |
string |
None |
renderCardCustom card content, rendered inside the component-owned shell. Set in JavaScript. |
Property only | (card: Card) => TemplateResult |
None |
draggableProgressive enhancement: enable pointer drag of cards between lanes. The move menu and keyboard shortcuts remain the accessibility contract (WCAG 2.5.7); drag never replaces them. |
draggable reflected |
boolean |
false |
Events
| Event | Description |
|---|---|
dj-card-move | detail { card, key, from, to, fromIndex, toIndex }; the board never
applies it itself |
dj-card-click | detail { card, key } |
Slots
| Slot | Description |
|---|---|
none | cards come from data |
CSS parts
Style these with dj-board::part(name).
boardlanelane-overlane-headerlane-titlelane-countlane-bodycardmove-buttonlane${over?
Methods
| Method | Description |
|---|---|
effectiveLanes(): BoardLane[] | The lanes to display: the lanes property, or distinct group-by values in data order. |
Types
The types that the properties above use, as they are declared in the source.
Card
export type Card = Record<string, unknown>;
BoardLane
export interface BoardLane {
value: string;
label?: string;
limit?: number;
}