Data display
Kanban
A board of columns holding cards that can be dragged within a column and between columns, for the stages of a workflow: tasks, leads, orders.
Todo
Doing
Done
Nothing to show
Gray columns side by side, scrolling sideways when they don't fit, each with its title and a count. Dragging a card and dropping it on another column (or elsewhere in the same one) moves it there and fires moved: dropping the first "To do" card at the second place of "Done" calls move('7', 'done', 1).
Header and footer #
A column with a subtitle, a red badge and a menu button, a card that is a button opening the task, with a badge above its text and an avatar under it, and an "Add card" button at the bottom of the column.
To do
Nothing to show
Reference
tk:kanban
└── tk:kanban.column ...
└── tk:kanban.card ...
tk:kanban
| Prop | Type | Default | Description |
|---|---|---|---|
size |
string | md |
xs, sm, md, lg, xl, 2xl or 3xl. Sets the spacing, inherited by the columns and cards. |
Slots
| Slot | Description |
|---|---|
| default | The columns. |
Events
| Event | Detail | When |
|---|---|---|
moved |
{ card, column, position }: the card's key, the key of the column it was dropped on and its index there, from 0 |
A card was dropped in a new place. |
tk:kanban.column
| Prop | Type | Default | Description |
|---|---|---|---|
key |
string | int | null |
The column's key, sent in moved. |
heading |
string | slot | null |
The title, translated. |
subheading |
string | slot | null |
Muted text under the title. |
count |
int | null |
A small round badge with the number next to the title. |
badge |
string | slot | null |
A badge next to the title. |
Slots
| Slot | Description |
|---|---|
| default | The cards. |
actions |
Controls at the end of the header. |
footer |
Content under the cards. |
tk:kanban.card
| Prop | Type | Default | Description |
|---|---|---|---|
key |
string | int | null |
The card's key, sent in moved. |
as |
string | div |
button or a makes the card clickable. |
Slots
| Slot | Description |
|---|---|
| default | The card's content. |
header, footer |
Content above and under it. |
Events
moved is dispatched on tk:kanban and does not bubble.
With Alpine:
Nothing to show
Customization
Classes go to the board, the column's <section> and the card. The column takes prefixes:
| Prefix | Tag | Goes to |
|---|---|---|
header: |
tk:kanban.column |
The header. |
badge: |
tk:kanban.column |
The badge (badge:color="red"). |
cards: |
tk:kanban.column |
The list of cards. |
footer: |
tk:kanban.column, tk:kanban.card |
The footer. |
header: |
tk:kanban.card |
The content above the card's. |
Nothing to show
Accessibility
Each column is a <section> whose title is an <h3>. Dragging works with a mouse, a pen or touch; there is no keyboard way to move a card, so give keyboard users another one, such as a menu on the card (as="button") with the stages to move it to.
Behavior notes
- Dropping a card moves it in the page right away. Save the move in
movedand render the board in the new order: on the next Livewire update the board shows what the server sends. - The columns don't change their counts by themselves; they show what you pass.