Kanban
import { KanbanBoard } from '@hanzo/ui'
Default
Columns of draggable cards with search, priority, labels and a column limit.
Project Board
To Do1/5
Setup project
Initialize the project structureBug
high
Alex
In Progress1
Build the board
medium
12/31/2024
Done0
export function Default() {
const [board, setBoard] = useState(seed)
return (
<YStack width="100%" height={520}>
<KanbanBoard board={board} onUpdateBoard={setBoard} />
</YStack>
)
}Column limit
"To Do" caps at one card; its Add button disables once that's reached.
Project Board
To Do1/1
Setup project
Initialize the project structureBug
high
Alex
In Progress1
Build the board
medium
12/31/2024
Done0
export function ColumnLimit() {
const [board, setBoard] = useState<KanbanBoardData>(() => {
const next = seed()
next.columns[0].limit = 1
return next
})
return (
<YStack width="100%" height={420}>
<KanbanBoard board={board} onUpdateBoard={setBoard} />
</YStack>
)
}Empty board
Three columns with no cards yet, ready to fill in from the Add button.
New Board
To Do0
In Progress0
Done0
export function Empty() {
const [board, setBoard] = useState<KanbanBoardData>({
id: 'board-2',
title: 'New Board',
labels: [],
columns: [
{ id: 'todo', title: 'To Do', cards: [] },
{ id: 'doing', title: 'In Progress', cards: [] },
{ id: 'done', title: 'Done', cards: [] },
],
})
return (
<YStack width="100%" height={420}>
<KanbanBoard board={board} onUpdateBoard={setBoard} />
</YStack>
)
}Types
export interface KanbanLabel {
id: string
name: string
color: string
}export type KanbanPriority = 'low' | 'medium' | 'high' | 'urgent'export interface KanbanCard {
id: string
title: string
description?: string
labels?: KanbanLabel[]
priority?: KanbanPriority
assignee?: string
dueDate?: string
createdAt: string
updatedAt: string
}export interface KanbanColumn {
id: string
title: string
cards: KanbanCard[]
limit?: number
}export interface KanbanBoardData {
id: string
title: string
columns: KanbanColumn[]
labels: KanbanLabel[]
}export type KanbanBoardProps = {
board: KanbanBoardData
onUpdateBoard: (board: KanbanBoardData) => void
className?: string
}Exports
KanbanBoardtype KanbanBoardDatatype KanbanBoardPropstype KanbanCardtype KanbanColumntype KanbanLabeltype KanbanPriority