Searching Puzzle Pieces

Type to search Puzzle Pieces.

Kanban

A config-first, controlled board: horizontal columns each holding a vertical list of cards, with pointer drag-and-drop and full keyboard moves. The parent owns the data — the board emits a @move intent and you apply it, passing new columns back down.

To do

3
  • Design empty states

    Design
    ALAda Lovelace
  • Fix drag on Safari

    Bug

    Due Fri

  • Write changelog

    Small

In progress

2
  • Ship keyboard DnD

    a11y
    GHGrace Hopper
  • Placeholder indicator

    In review

Done

1
  • Token audit

    Done
    ATAlan Turing

Last move: none

Installation

Copy the piece into your app — it compiles with your build and the code is yours:

puzzle add piece kanban

No registry or npm dependencies. Requires the pieces.css tokens merged into your app styles (see Introduction).

Two files land in your app: Kanban.pzl owns the columns and all the drag-and-drop, and KanbanCard.pzl owns what a single card looks like. Edit the card file to change card content or read extra fields off your own objects — the board renders it both as the row in a column and as the ghost that follows your pointer, so the two never drift apart.

Usage

import Kanban from '@/components/ui/Kanban.pzl';
<Kanban columns={ columns } @move={ onMove } label="Sprint board"/>

Data shape and the move contract

Cards live inside their column. Each card needs a board-unique id and a title; badge, badgeVariant, meta, and assignee are optional.

columns: [
  {
    id: 'todo',              // stable column id
    title: 'To do',
    cards: [
      {
        id: 'c1',            // board-unique card id
        title: 'Card title',
        badge: 'Bug',        // optional chip text
        badgeVariant: 'danger', // default | brand | danger | outline
        meta: 'Due Fri',     // optional secondary line
        assignee: 'Ada Lovelace', // optional → initials disc
      },
    ],
  },
]

@move({ cardId, toColumnId, toIndex, event }) hands you a splice-into-the-remaining-list index: toIndex is where the card should land in the destination column after it has been removed from its source, so it is always in [0, destRemainingLength]. Remove-then-insert and you match the placeholder the user saw.

Disabled

Backlog

2
  • Locked task

    Read-only

  • Another item

    Later

Shipped

1
  • Released v1

    Done

Keyboard

Full keyboard drag-and-drop, announced through a polite live region:

  • Tab moves focus between cards.
  • Space or Enter picks up the focused card (aria-grabbed="true"); press again to drop it.
  • While a card is held, ↑↓ reorder it within its column and ←→ move it to the adjacent column at a comparable index. Each step emits @move and keeps the card held and refocused.
  • Esc cancels a pickup (pointer drags cancel on Escape too, with no move emitted).

Accessibility

  • The board is a role="group" with an accessible name from label; each column is a labelled section wrapping a role="list" of cards.
  • Every pickup, move, drop, and cancel is announced through a polite aria-live region.
  • Card focus outlines set their color unconditionally, so the ring never flashes from a default color on first focus.
  • Pointer drags rely on window listeners and root-level pointer capture, so a drag that leaves the board (or whose source card is removed mid-drag) still completes.