Kanban
Drag-and-drop board of columns and cards, driven by a `columns` array. Cards move by pointer or keyboard, and each move fires `arc-card-move`.
<arc-kanban>Overview
Kanban renders a horizontally scrolling row of columns from one columns array. Each column has an id, a title, an optional work-in-progress limit and an items array of cards. Each card has a label, and optionally a description and an arc-tag chip.
Drag a card with the pointer and a floating ghost follows the cursor, with a line marking where it will land. Dragging near the left or right edge scrolls the board. The board moves the card in its own internal copy straight away and fires arc-card-move with the card id, source column, target column and final index. Listen for it, update your data, then pass the new array back in.
From the keyboard, each column's card list is one tab stop. ArrowUp and ArrowDown move between cards, and ArrowLeft and ArrowRight move between columns. Enter or Space grabs the focused card, the arrows move it, Enter drops it (firing the same arc-card-move) and Escape puts it back. A polite live region announces every grab, move, drop and cancel.
Guidelines
Do
- Give every column and card a stable, unique id. Rendering and moves are keyed on it
- Set a `limit` on columns that have a work-in-progress cap
- Keep card labels short and put detail in the description
- Use tag variants (primary, success, error and so on) to show a card's category
Don't
- Don't mutate the `columns` array in place. Assign a new array to re-render
- Don't use it for a single list. Use arc-sortable-list or arc-list
- Don't expect many columns to fit without horizontal scrolling. Each one is a fixed 280px wide
Features
- With a `limit`, the column header shows `count/limit` and turns error-colored when the column is over it
- Card descriptions clamp to two lines
- An empty column shows a dashed drop zone that highlights during a drag
- `arc-card-click` fires when a card is clicked without being dragged
Preview
Usage
This component needs JavaScript. Use the Web Component or a framework wrapper.
<arc-kanban id="board"></arc-kanban>
<script type="module">
import '@arclux/arc-ui/kanban';
const board = document.querySelector('#board');
let columns = [
{ id: 'todo', title: 'To Do', items: [
{ id: 't1', label: 'Design onboarding flow', description: 'Draft wireframes for the first-run experience.', tag: 'Design', variant: 'secondary' },
{ id: 't2', label: 'Audit color tokens' }
]},
{ id: 'doing', title: 'In Progress', limit: 2, items: [
{ id: 'd1', label: 'Refactor auth middleware', tag: 'Backend', variant: 'primary' }
]},
{ id: 'done', title: 'Done', items: [
{ id: 'x1', label: 'Set up CI pipeline', tag: 'Infra' }
]}
];
board.columns = columns;
// Sync the source of truth from move events
board.addEventListener('arc-card-move', (e) => {
const { cardId, fromColumn, toColumn, index } = e.detail;
columns = moveCard(columns, cardId, fromColumn, toColumn, index);
});
</script>import { useState } from 'react';
import { Kanban } from '@arclux/arc-ui-react';
const initial = [
{ id: 'todo', title: 'To Do', items: [
{ id: 't1', label: 'Design onboarding flow', description: 'Draft wireframes for the first-run experience.', tag: 'Design', variant: 'secondary' },
{ id: 't2', label: 'Audit color tokens' }
]},
{ id: 'doing', title: 'In Progress', limit: 2, items: [
{ id: 'd1', label: 'Refactor auth middleware', tag: 'Backend', variant: 'primary' }
]},
{ id: 'done', title: 'Done', items: [
{ id: 'x1', label: 'Set up CI pipeline', tag: 'Infra' }
]}
];
export function Board() {
const [columns, setColumns] = useState(initial);
return (
<Kanban
columns={columns}
onArcCardMove={(e) => {
const { cardId, fromColumn, toColumn, index } = e.detail;
setColumns((cols) => moveCard(cols, cardId, fromColumn, toColumn, index));
}}
onArcCardClick={(e) => openCardDetail(e.detail.cardId)}
/>
);
}<script setup>
import { ref } from 'vue';
import { Kanban } from '@arclux/arc-ui-vue';
const columns = ref([
{ id: 'todo', title: 'To Do', items: [
{ id: 't1', label: 'Design onboarding flow', tag: 'Design', variant: 'secondary' }
]},
{ id: 'doing', title: 'In Progress', limit: 2, items: [
{ id: 'd1', label: 'Refactor auth middleware', tag: 'Backend', variant: 'primary' }
]},
{ id: 'done', title: 'Done', items: [] }
]);
function onMove(e) {
const { cardId, fromColumn, toColumn, index } = e.detail;
columns.value = moveCard(columns.value, cardId, fromColumn, toColumn, index);
}
</script>
<template>
<Kanban :columns="columns" @arc-card-move="onMove" />
</template><script>
import { Kanban } from '@arclux/arc-ui-svelte';
let columns = [
{ id: 'todo', title: 'To Do', items: [
{ id: 't1', label: 'Design onboarding flow', tag: 'Design', variant: 'secondary' }
]},
{ id: 'doing', title: 'In Progress', limit: 2, items: [
{ id: 'd1', label: 'Refactor auth middleware', tag: 'Backend', variant: 'primary' }
]},
{ id: 'done', title: 'Done', items: [] }
];
function onMove(e) {
const { cardId, fromColumn, toColumn, index } = e.detail;
columns = moveCard(columns, cardId, fromColumn, toColumn, index);
}
</script>
<Kanban {columns} on:arc-card-move={onMove} />import { Component } from '@angular/core';
import { Kanban } from '@arclux/arc-ui-angular';
@Component({
imports: [Kanban],
template: `
<arc-kanban [columns]="columns" (arcCardMove)="onMove($event)"></arc-kanban>
`,
})
export class BoardComponent {
columns = [
{ id: 'todo', title: 'To Do', items: [
{ id: 't1', label: 'Design onboarding flow', tag: 'Design', variant: 'secondary' }
]},
{ id: 'doing', title: 'In Progress', limit: 2, items: [
{ id: 'd1', label: 'Refactor auth middleware', tag: 'Backend', variant: 'primary' }
]},
{ id: 'done', title: 'Done', items: [] }
];
onMove(e: CustomEvent) {
const { cardId, fromColumn, toColumn, index } = e.detail;
this.columns = moveCard(this.columns, cardId, fromColumn, toColumn, index);
}
}API
columnsArray<{id:string,title?:string,limit?:number,items:Array<{id:string,label:string,description?:string,tag?:string,variant?:string}>}>[]- The data array that drives the board. Each entry becomes a column with a header (title plus count badge) and a list of cards.
limitrenders the count ascount/limitand turns it error-colored when exceeded. Each card needs a uniqueidand alabel;descriptionrenders below the label with a two-line clamp, andtagrenders an arc-tag chip styled byvariant. Set as a property, or as a JSON attribute for a board that is static. The component works on an internal copy for immediate drag feedback; sync your source of truth fromarc-card-moveand assign a new array to re-render. disabledbooleanfalse- Disables all pointer and keyboard interaction and dims the board.
Events
arc-card-move- Fired when a card is dropped in a new position (pointer or keyboard). detail: { cardId, fromColumn, toColumn, index } where index is the final position in the target column.
arc-card-click- Fired when a card is clicked without being dragged. detail: { cardId, columnId }.
See also
- Sortable ListA list people reorder by dragging a grip handle or with the keyboard, with a line marking where the item will land.
- Data GridGrid for tabular data with inline editing, multi-column sorting, pinned columns, row selection and virtual scrolling. Columns are a JavaScript array, and the whole grid is one tab stop with the WAI-ARIA grid keyboard pattern.
- TagA small uppercase pill for a category or filter, with an optional button to remove it.