View as Markdown

API reference: @salmonui/kanban

KanbanPropsinterface

import type { KanbanProps } from '@salmonui/kanban';
interface KanbanProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onChange' | 'defaultValue'> {
    readonly data: readonly T[] | KanbanDataSource<T>;
    readonly getCardId: (card: T) => KanbanKey;
    readonly columnField: string;
    readonly columns?: readonly KanbanColumnDef[] | undefined;
    readonly children?: ReactNode;
    readonly showEmptyColumns?: boolean | undefined;
    readonly collapsedColumns?: readonly KanbanKey[] | undefined;
    readonly defaultCollapsedColumns?: readonly KanbanKey[] | undefined;
    readonly onCollapsedColumnsChange?: ((value: readonly KanbanKey[], details: KanbanChangeDetails) => void) | undefined;
    readonly limitScope?: 'column' | 'swimlane' | undefined;
    readonly columnGroups?: readonly KanbanColumnGroup[] | undefined;
    readonly swimlanes?: KanbanSwimlanes | undefined;
    readonly card?: KanbanCardFields | undefined;
    readonly renderCard?: ((ctx: KanbanCardContext<T>) => ReactNode) | undefined;
    readonly cardHeight?: number | 'auto' | undefined;
    readonly getCardProps?: ((ctx: KanbanCardContext<T>) => KanbanCardProps | undefined) | undefined;
    readonly selection?: 'none' | 'single' | 'multiple' | undefined;
    readonly selectedCards?: readonly KanbanKey[] | undefined;
    readonly defaultSelectedCards?: readonly KanbanKey[] | undefined;
    readonly onSelectedCardsChange?: ((value: readonly KanbanKey[], details: KanbanChangeDetails) => void) | undefined;
    readonly sort?: KanbanSort<T> | undefined;
    readonly filter?: ((card: T) => boolean) | undefined;
    readonly query?: KanbanQuery | undefined;
    readonly loading?: boolean | undefined;
    readonly cardsDraggable?: boolean | undefined;
    readonly onCardMove?: ((event: KanbanCardMoveEvent<T>) => void) | undefined;
    readonly dragGroup?: string | undefined;
    readonly dropTargets?: readonly KanbanDropTarget<T>[] | undefined;
    readonly columnsReorderable?: boolean | undefined;
    readonly columnOrder?: readonly KanbanKey[] | undefined;
    readonly defaultColumnOrder?: readonly KanbanKey[] | undefined;
    readonly onColumnOrderChange?: ((value: readonly KanbanKey[], details: KanbanChangeDetails) => void) | undefined;
    readonly onCardChange?: ((event: KanbanCardChangeEvent<T>) => void) | undefined;
    readonly onCardAdd?: ((event: KanbanCardAddEvent) => void) | undefined;
    readonly newCard?: ((at: KanbanCellRef) => T) | undefined;
    readonly editor?: boolean | {
        readonly fields: readonly KanbanEditorField<T>[];
    } | undefined;
    readonly renderEditor?: ((ctx: KanbanEditorContext<T>) => ReactNode) | undefined;
    readonly editing?: KanbanEditing | undefined;
    readonly defaultEditing?: KanbanEditing | undefined;
    readonly onEditingChange?: ((value: KanbanEditing, details: KanbanChangeDetails) => void) | undefined;
    readonly tooltip?: boolean | KanbanTooltip<T> | undefined;
    readonly virtualization?: boolean | undefined;
    readonly height?: number | string | undefined;
    readonly onCardClick?: ((event: KanbanCardClickEvent<T>) => void) | undefined;
    readonly onCardDoubleClick?: ((event: KanbanCardClickEvent<T>) => void) | undefined;
    readonly onDataError?: ((error: unknown, kind: 'read' | 'write') => void) | undefined;
    readonly localeText?: Partial<KanbanLocaleText> | undefined;
    readonly ref?: Ref<KanbanApi> | undefined;
}
KanbanProps members (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;