INTEGRATIONS / TASKS
Keep the order yours.
The board and backlog are two views of the same tasks. Use the local example, or connect its save contract to your application.
Start with the interaction.
The Kanban control accepts controlled items, columns and an onMove callback. The task workspace adds creation, Board/Backlog views, pending saves, rollback, retry and cancellation. Both Next.js and Vite starters include the same source.
npx shadcn@latest add https://ui.bld8.dev/r/task-workspace.jsonSave an ordered snapshot.
'use client';
import {TaskWorkspace} from '@bld8/blocks';
export default function Tasks() {
return <TaskWorkspace initialTasks={ownedTasks} initialRevision={revision}
onSave={async (tasks, {signal, expectedRevision}) => {
const response = await fetch('/api/tasks', {
method:'PUT', signal, headers:{'Content-Type':'application/json'},
body:JSON.stringify({tasks, expectedRevision})
});
if (!response.ok) throw new Error('Task changes could not be saved.');
return response.json(); // {tasks, revision}: the committed board
}} />;
}Registry installs use the equivalent local bld8/blocks/task-workspace path. Initial values seed a mounted workspace; remount with a new key to load a different board. Your endpoint must authenticate the user, authorise the board, validate all tasks and column limits, compare the expected revision and commit the whole snapshot atomically. Return a greater positive revision and the committed tasks. No endpoint, database or collaboration service is included.
A precise move contract.
import {applyKanbanMove} from '@bld8/ui/kanban-state';
const next = applyKanbanMove(items, {
itemId:'task-1', fromColumnId:'planned',
toColumnId:'progress', beforeId:'task-4'
}, columns);
// beforeId:null appends to the destination column.The pure helper returns an immutable array and rejects a stale source column, missing destination anchor or exceeded column limit. It is useful in server code too; it does not replace ownership checks or a board revision. Stable item and column IDs are required. This version supports up to 500 loaded cards, without virtualisation.
Keyboard, touch and motion.
Drag only from a card’s handle. On touch, hold the handle briefly before moving; the rest of the card stays available for page scrolling. Select that same Move button with the keyboard to choose a destination and an exact position. The dialog uses the shared selects and returns focus to the moved card. Escape cancels an active drag and restores the original order.
Cards move with the shared easing curve and a restrained lifted shadow. Reduced-motion settings remove displacement transitions and drop animation. Board and Backlog share the same data; narrow containers stack the columns in reading order.
Failure and cancellation.
The block previews a move while saving and prevents another write until it settles. A rejected save restores the previous order and offers retry. New-task failures retain the form draft. Cancel save aborts the callback signal, restores the prior snapshot and ignores a late completion. A server may have already committed an aborted request, so reload the authoritative board before retrying after an uncertain network result.
The default example keeps tasks in memory for the current session. The preview chooser demonstrates loading, connection errors, rejected writes, slow saves and empty data. These states use local fixtures; they make no external requests.