View as Markdown

API reference: @salmonui/kanban

Kanbancomponent

import { Kanban } from '@salmonui/kanban';
function Kanban<T>(props: KanbanProps<T>): ReactNode;

The Kanban board.

Props: KanbanProps

Kanban props (48)
NameSignatureDescription
datareadonly data: readonly T[] | KanbanDataSource<T>;

Cards (an array, copied for built-in writes), or a @salmonui/data source. A new array resets the board's copy.

getCardIdreadonly getCardId: (card: T) => KanbanKey;
columnFieldreadonly columnField: string;

Card field that holds the column key.

columnsoptionalreadonly columns?: readonly KanbanColumnDef[] | undefined;
childrenoptionalreadonly children?: ReactNode;

KanbanColumn elements: the declarative alternative to columns.

showEmptyColumnsoptionalreadonly showEmptyColumns?: boolean | undefined;

Shows columns without cards (default true).

collapsedColumnsoptionalreadonly collapsedColumns?: readonly KanbanKey[] | undefined;
defaultCollapsedColumnsoptionalreadonly defaultCollapsedColumns?: readonly KanbanKey[] | undefined;
onCollapsedColumnsChangeoptionalreadonly onCollapsedColumnsChange?: ((value: readonly KanbanKey[], details: KanbanChangeDetails) => void) | undefined;
limitScopeoptionalreadonly limitScope?: 'column' | 'swimlane' | undefined;

WIP limits count per column (default) or per swimlane cell.

columnGroupsoptionalreadonly columnGroups?: readonly KanbanColumnGroup[] | undefined;
swimlanesoptionalreadonly swimlanes?: KanbanSwimlanes | undefined;
cardoptionalreadonly card?: KanbanCardFields | undefined;
renderCardoptionalreadonly renderCard?: ((ctx: KanbanCardContext<T>) => ReactNode) | undefined;

Replaces the card body. Pure; called for rendered cards only.

cardHeightoptionalreadonly cardHeight?: number | 'auto' | undefined;

Fixed card height in px, or 'auto' (default) for measured heights.

getCardPropsoptionalreadonly getCardProps?: ((ctx: KanbanCardContext<T>) => KanbanCardProps | undefined) | undefined;
selectionoptionalreadonly selection?: 'none' | 'single' | 'multiple' | undefined;

Default 'single'.

selectedCardsoptionalreadonly selectedCards?: readonly KanbanKey[] | undefined;
defaultSelectedCardsoptionalreadonly defaultSelectedCards?: readonly KanbanKey[] | undefined;
onSelectedCardsChangeoptionalreadonly onSelectedCardsChange?: ((value: readonly KanbanKey[], details: KanbanChangeDetails) => void) | undefined;
sortoptionalreadonly sort?: KanbanSort<T> | undefined;
filteroptionalreadonly filter?: ((card: T) => boolean) | undefined;

Client-side card filter (pure).

queryoptionalreadonly query?: KanbanQuery | undefined;

Base query of source reads; a new identity re-reads, so memoize it (as data for a source).

loadingoptionalreadonly loading?: boolean | undefined;

Forces the loading state.

cardsDraggableoptionalreadonly cardsDraggable?: boolean | undefined;

Enables pointer and keyboard card drag.

onCardMoveoptionalreadonly onCardMove?: ((event: KanbanCardMoveEvent<T>) => void) | undefined;
dragGroupoptionalreadonly dragGroup?: string | undefined;

Boards with the same group accept each other's cards.

dropTargetsoptionalreadonly dropTargets?: readonly KanbanDropTarget<T>[] | undefined;
columnsReorderableoptionalreadonly columnsReorderable?: boolean | undefined;

Enables column reorder by pointer and Alt+Arrow keys.

columnOrderoptionalreadonly columnOrder?: readonly KanbanKey[] | undefined;
defaultColumnOrderoptionalreadonly defaultColumnOrder?: readonly KanbanKey[] | undefined;
onColumnOrderChangeoptionalreadonly onColumnOrderChange?: ((value: readonly KanbanKey[], details: KanbanChangeDetails) => void) | undefined;
onCardChangeoptionalreadonly onCardChange?: ((event: KanbanCardChangeEvent<T>) => void) | undefined;
onCardAddoptionalreadonly onCardAdd?: ((event: KanbanCardAddEvent) => void) | undefined;
newCardoptionalreadonly newCard?: ((at: KanbanCellRef) => T) | undefined;

Draft of a new card in a cell (default: { id: 'new-<n>', [columnField], [swimlanes.field] }); called once when the editor opens for a new card, never during render.

editoroptionalreadonly editor?: boolean | { readonly fields: readonly KanbanEditorField<T>[]; } | undefined;

Built-in editor: true edits the card fields, or a field list.

renderEditoroptionalreadonly renderEditor?: ((ctx: KanbanEditorContext<T>) => ReactNode) | undefined;
editingoptionalreadonly editing?: KanbanEditing | undefined;
defaultEditingoptionalreadonly defaultEditing?: KanbanEditing | undefined;
onEditingChangeoptionalreadonly onEditingChange?: ((value: KanbanEditing, details: KanbanChangeDetails) => void) | undefined;
tooltipoptionalreadonly tooltip?: boolean | KanbanTooltip<T> | undefined;
virtualizationoptionalreadonly virtualization?: boolean | undefined;

Per-column card virtualization; ignored with swimlanes.

heightoptionalreadonly height?: number | string | undefined;

Board height (px or CSS length); columns scroll inside it.

onCardClickoptionalreadonly onCardClick?: ((event: KanbanCardClickEvent<T>) => void) | undefined;
onCardDoubleClickoptionalreadonly onCardDoubleClick?: ((event: KanbanCardClickEvent<T>) => void) | undefined;

Default action: opens the editor (with editor).

onDataErroroptionalreadonly onDataError?: ((error: unknown, kind: 'read' | 'write') => void) | undefined;

Read and write failures of a source (writeError reverts the optimistic change).

localeTextoptionalreadonly localeText?: Partial<KanbanLocaleText> | undefined;
refoptionalreadonly ref?: Ref<KanbanApi> | undefined;