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/30/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/30/2024
Done0
export function ColumnLimit() {const [board, setBoard] = useState<KanbanBoardData>(() => {const next = seed()next.columns[0].limit = 1return 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: stringname: stringcolor: string}
export type KanbanPriority = 'low' | 'medium' | 'high' | 'urgent'
export interface KanbanCard {id: stringtitle: stringdescription?: stringlabels?: KanbanLabel[]priority?: KanbanPriorityassignee?: stringdueDate?: stringcreatedAt: stringupdatedAt: string}
export interface KanbanColumn {id: stringtitle: stringcards: KanbanCard[]limit?: number}
export interface KanbanBoardData {id: stringtitle: stringcolumns: KanbanColumn[]labels: KanbanLabel[]}
export type KanbanBoardProps = {board: KanbanBoardDataonUpdateBoard: (board: KanbanBoardData) => voidclassName?: string}
Exports
KanbanBoardtype KanbanBoardDatatype KanbanBoardPropstype KanbanCardtype KanbanColumntype KanbanLabeltype KanbanPriority