Apps

Kanban

A board with WIP limits, drag and drop for mouse, touch and keyboard, filters, a card panel and a list view.

composables/apps/useKanban.ts
View in the demo

The board (name, due, columns with an optional WIP limit, cards) comes from the provider. Cards carry assignees, description, priority, checklist items, attachments and comments. Every move goes through move(), which returns full instead of breaking a column limit.

Every app follows the same pattern: typed models in types/models/, demo data in mocks/, state and actions in a composable under composables/apps/, page-only components in components/pages/<app>/ and UI strings in locales/<code>/apps.json. Read the apps overview once and every app looks familiar.

Files

File
Role
pages/kanban.vueThe page: filters, board or list and the drag provider.
composables/apps/useKanban.tsBoard state, filters, moves and CRUD.
composables/apps/useKanbanDrag.tsprovideKanbanDrag() and useKanbanDrag(): mouse, touch and auto-scroll.
types/models/kanban.tsBoard, columns, cards and the provider.
config/kanban.config.tsLabels, priorities, column colours, default view and the due soon window.
utils/kanban.tsPure rules, unit tested.
components/pages/kanban/KanbanColumn, KanbanCard, KanbanCardPanel, KanbanList, KanbanToolbar, KanbanCardFormDialog, KanbanColumnFormDialog.

Data and provider

types/models/kanban.ts
export interface KanbanProvider {
  load: () => Promise<KanbanBoard>
  saveCard: (card: KanbanCard) => Promise<void>
  removeCard: (id: string) => Promise<void>
  moveCard: (id: string, columnId: string, index: number) => Promise<void>
  saveColumn: (column: KanbanColumn, index: number) => Promise<void>
  removeColumn: (id: string) => Promise<void>
}

Connect your backend

The page calls useKanban() with the mock provider. Write a provider that calls your API with useApi() and pass it in the page. The composable loads it through useAsyncData and applies every change optimistically, so the interface does not wait for the server.

providers/kanban.ts
import type { KanbanBoard, KanbanProvider } from '~/types/models/kanban'

export function createKanbanApiProvider(): KanbanProvider {
  const api = useApi()

  return {
    load: () => api<KanbanBoard>('/board'),
    saveCard: (card) => api(`/cards/${card.id}`, { method: 'PUT', body: card }),
    removeCard: (id) => api(`/cards/${id}`, { method: 'DELETE' }),
    moveCard: (id, columnId, index) => api(`/cards/${id}/move`, { method: 'POST', body: { columnId, index } }),
    saveColumn: (column, index) => api(`/columns/${column.id}`, { method: 'PUT', body: { ...column, index } }),
    removeColumn: (id) => api(`/columns/${id}`, { method: 'DELETE' }),
  }
}
pages/kanban.vue
<script setup lang="ts">
import { createKanbanApiProvider } from '~/providers/kanban'

const { ... } = useKanban({ provider: createKanbanApiProvider() })
</script>

Keep ids in your data and labels in the locales: folders, labels and tags resolve their names through apps.<app>.* unless you give them a raw title. See Connect your API for the token, validation errors and the actions the demo only fakes.

Configuration

KANBAN_LABELS

Card labels with their colour.

config/kanban.config.ts
const KANBAN_LABELS: KanbanLabelConfig[]

KANBAN_PRIORITIES

Priorities with their icon and colour.

config/kanban.config.ts
const KANBAN_PRIORITIES: KanbanPriorityConfig[]

KANBAN_COLUMN_COLORS

The colours a column can take.

config/kanban.config.ts
const KANBAN_COLUMN_COLORS: string[]

KANBAN_DEFAULT_VIEW

board or list. The user’s choice persists in the kanban-view cookie.

config/kanban.config.ts
const KANBAN_DEFAULT_VIEW: KanbanViewSettings

KANBAN_DUE_SOON_DAYS

How many days before the due date a card counts as “due soon”.

config/kanban.config.ts
const KANBAN_DUE_SOON_DAYS: 3

Rules

Pure functions in utils/, unit tested. Use them in your backend too if you want the same answers.

moveKanbanCard()

Moves a card and reorders both columns.

utils/kanban.ts
moveKanbanCard(cards: KanbanCard[], cardId: string, columnId: string, index?: number): KanbanCard[]

isColumnFull()

Whether a column reached its WIP limit.

utils/kanban.ts
isColumnFull(column: KanbanColumn, count: number): boolean

kanbanDueState()

The due state of a card.

utils/kanban.ts
kanbanDueState(due: string, today: string, isDone: boolean, soonDays: number): KanbanDueState

matchesKanbanFilters()

Whether a card passes the filters.

utils/kanban.ts
matchesKanbanFilters(card: KanbanCard, filters: KanbanFilters, dueState: KanbanDueState): boolean

checklistProgress()

Checklist progress.

utils/kanban.ts
checklistProgress(items: KanbanChecklistItem[]): { done: number; total: number; }
Returnsdonetotal

How it works

  • Mouse uses native HTML5 drag; touch uses a 300 ms long press. Both resolve the drop target with pointAt() from [data-kanban-column] and [data-kanban-card], and touch auto-scrolls [data-kanban-board] near its edges.
  • A focused card moves with Alt + arrows. Every move is announced in an aria-live region and focus follows the card.
  • Filters (search, people through BaseAvatarGroup selectable, labels through BaseMenuOptions, due soon) apply to both views and show a BaseEmptyState when nothing matches.
  • Each column has a “…” menu: edit name, colour and limit, sort by due date, collapse and delete when empty.
  • When the board is narrower than every column at KANBAN_COLUMN_MIN_WIDTH (232px, in config/kanban.config.ts), the columns stack vertically instead of scrolling sideways: each one is a full-width section with a chevron that folds it to its header, and its cards fill a grid of 260px tracks. Touch drag then scrolls the page near the top and bottom edges, and the drop index follows both rows and columns of that grid.
  • Clicking a card opens KanbanCardPanel, a temporary drawer with status, facts, checklist, attachments and comments. The form dialog is only for creating and full edits.
  • KanbanList is a BaseDataTable grouped by column with bulk move and delete and an inline status menu.
© 2026 melsami UI.
Developer documentation for melsami UI.