Demo
Kanban with 10,000 cards
Documented in Kanban performance and mobile layout.
Kanban with 10,000 cards
Five columns of 2,000 cards each with per-column virtualization, measured variable card heights, drag auto-scroll and focusCard through the ref API.
New2000
Triage2000
Build2000
Verify2000
Shipped2000
New, 2000 cards
Item 1
A longer description that wraps onto a second line to vary the card height.
Item 6
Short note.
Item 11
Short note.
Item 16
A longer description that wraps onto a second line to vary the card height.
Item 21
Short note.
Item 26
Short note.
Item 31
A longer description that wraps onto a second line to vary the card height.
Triage, 2000 cards
Item 2
Short note.
Item 7
A longer description that wraps onto a second line to vary the card height.
Item 12
Short note.
Item 17
Short note.
Item 22
A longer description that wraps onto a second line to vary the card height.
Item 27
Short note.
Item 32
Short note.
Build, 2000 cards
Item 3
Short note.
Item 8
Short note.
Item 13
A longer description that wraps onto a second line to vary the card height.
Item 18
Short note.
Item 23
Short note.
Item 28
A longer description that wraps onto a second line to vary the card height.
Item 33
Short note.
Verify, 2000 cards
Item 4
A longer description that wraps onto a second line to vary the card height.
Item 9
Short note.
Item 14
Short note.
Item 19
A longer description that wraps onto a second line to vary the card height.
Item 24
Short note.
Item 29
Short note.
Item 34
A longer description that wraps onto a second line to vary the card height.
Shipped, 2000 cards
Item 5
Short note.
Item 10
A longer description that wraps onto a second line to vary the card height.
Item 15
Short note.
Item 20
Short note.
Item 25
A longer description that wraps onto a second line to vary the card height.
Item 30
Short note.
Item 35
Short note.
Press Space to pick up. Arrow keys move, Space drops, Escape cancels.
Demo.tsx
'use client';
import { useMemo, useRef, useState } from 'react';
import { Button } from '@salmonui/buttons/button';
import { Kanban, type KanbanApi, type KanbanColumnDef } from '@salmonui/kanban';
import { NumberField } from '@salmonui/inputs/number-field';
interface Item {
id: number;
title: string;
detail: string;
stage: string;
}
const STAGES = ['new', 'triage', 'build', 'verify', 'shipped'] as const;
const COLUMNS: readonly KanbanColumnDef[] = STAGES.map((stage) => ({
key: stage,
header: stage[0]!.toUpperCase() + stage.slice(1),
}));
const PER_COLUMN = 2000;
/** 10,000 cards, deterministic so the server and client render the same board. */
function makeItems(): Item[] {
const items: Item[] = [];
for (let i = 0; i < STAGES.length * PER_COLUMN; i++) {
// Every third card has a longer body: heights vary and are measured.
items.push({
id: i + 1,
title: `Item ${i + 1}`,
detail: i % 3 === 0 ? 'A longer description that wraps onto a second line to vary the card height.' : 'Short note.',
stage: STAGES[i % STAGES.length]!,
});
}
return items;
}
export default function KanbanVirtualizationDemo() {
const api = useRef<KanbanApi>(null);
const items = useMemo(makeItems, []);
const [target, setTarget] = useState<number | null>(7777);
return (
<div style={{ display: 'grid', gap: 12 }}>
<form
style={{ display: 'flex', gap: 8, alignItems: 'center' }}
onSubmit={(e) => {
e.preventDefault();
if (target != null) api.current?.focusCard(target);
}}
>
<label style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
Card id{' '}
<NumberField aria-label="Card id" min={1} max={items.length} value={target} onValueChange={setTarget} formatOptions={{ useGrouping: false }} style={{ inlineSize: 120 }} />
</label>
<Button type="submit">Go to card</Button>
</form>
<Kanban
ref={api}
aria-label="Large board"
data={items}
getCardId={(item) => item.id}
columnField="stage"
columns={COLUMNS}
card={{ headerField: 'title', contentField: 'detail' }}
virtualization
height={480}
cardsDraggable
/>
</div>
);
}
Each column renders only the cards in view and measures their heights as they appear. Drag a card toward the bottom of a column to auto-scroll it. Go to card scrolls the card's column and moves focus to it. Narrow the window below 600 px of board width to see the one-column layout with its column picker.