Kanban

An accessible multi-column drag-and-drop board with optimistic commit metadata and independently scrolling columns.

registry:ui Registry JSON

Planned

Ready to begin

Release procurement package

Approve method statement

Active

Work in progress

Issue construction drawings

Done

Completed work

Complete site survey

Installation

pnpm dlx shadcn-svelte@latest add https://shadcn.cptckp.com/r/kanban.json

The CLI copies the source into your project and installs every dependency listed below.

Usage

import * as Kanban from '$lib/components/ui/kanban/index.js';
import type { KanbanColumn, KanbanValue } from '$lib/components/ui/kanban/index.js';
example.svelte
svelte
<script lang="ts">
	import * as Card from '$lib/components/ui/card/index.js';
	import * as Kanban from '$lib/components/ui/kanban/index.js';

	import type { KanbanColumn, KanbanValue } from '$lib/components/ui/kanban/index.js';

	interface WorkItem {
		id: string;
		title: string;
	}

	const columns: KanbanColumn[] = [
		{ id: 'planned', title: 'Planned', description: 'Ready to begin' },
		{ id: 'active', title: 'Active', description: 'Work in progress' },
		{ id: 'done', title: 'Done', description: 'Completed work' }
	];

	let value = $state.raw<KanbanValue<WorkItem>>({
		planned: [
			{ id: 'procurement', title: 'Release procurement package' },
			{ id: 'method', title: 'Approve method statement' }
		],
		active: [{ id: 'drawings', title: 'Issue construction drawings' }],
		done: [{ id: 'survey', title: 'Complete site survey' }]
	});
</script>

<Kanban.Root
	{columns}
	{value}
	getItemId={(item) => item.id}
	onValueChange={(next) => (value = next)}
	ariaLabel="Example work board"
>
	{#snippet item(item)}
		<Card.Root size="sm" class="gap-3 bg-card py-3">
			<Card.Content class="flex items-start gap-2 px-3">
				<Kanban.DragHandle label={`Move ${item.title}`} />
				<p class="pt-1 text-sm font-medium">{item.title}</p>
			</Card.Content>
		</Card.Root>
	{/snippet}
	{#snippet empty(column)}
		No work in {column.title.toLowerCase()}.
	{/snippet}
</Kanban.Root>

Files & dependencies

Installed asSource
kanban/index.tssrc/lib/registry/ui/kanban/index.ts
kanban/kanban-drag-handle.sveltesrc/lib/registry/ui/kanban/kanban-drag-handle.svelte
kanban/kanban.sveltesrc/lib/registry/ui/kanban/kanban.svelte
kanban/types.tssrc/lib/registry/ui/kanban/types.ts

npm dependencies

  • @lucide/svelte@^1.28.0
  • @thisux/sveltednd@0.4.1

Registry dependencies

  • button
  • card
  • scroll-area