# @salmonui/kanban API reference

> 35 exported symbols of @salmonui/kanban: 2 components, 28 interfaces, 4 types and 1 constant.

Canonical: https://salmonui.dev/docs/reference/kanban

```ts
import { … } from '@salmonui/kanban';
```

## Components

### Kanban

Kind: component

Page: https://salmonui.dev/docs/reference/kanban/Kanban

```ts
function Kanban<T>(props: KanbanProps<T>): ReactNode;
```

The Kanban board.

Props: [`KanbanProps`](https://salmonui.dev/docs/reference/kanban/KanbanProps) (its members are the props)

### KanbanColumn

Kind: component

Page: https://salmonui.dev/docs/reference/kanban/KanbanColumn

```ts
function KanbanColumn(_props: KanbanColumnProps): null;
```

A column declared as an element (`<Kanban><KanbanColumn columnKey="todo" header="To do" /></Kanban>`).
Renders nothing itself: the board reads the props of its direct
`KanbanColumn` children (and fragments), so the columns are in the
server HTML without a registration effect.

Props: [`KanbanColumnProps`](https://salmonui.dev/docs/reference/kanban/KanbanColumnProps) (its members are the props)

## Interfaces

### KanbanApi

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanApi

```ts
interface KanbanApi {
    readonly element: HTMLDivElement | null;
    focusCard(id: KanbanKey): void;
    scrollToCard(id: KanbanKey): void;
    openEditor(id: KanbanKey | 'new', at?: Partial<KanbanCellRef>): void;
    closeEditor(): void;
}
```

Commands props cannot express (`ref`).

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `element` | `readonly element: HTMLDivElement \| null;` |  |  |
| `focusCard` | `focusCard(id: KanbanKey): void;` |  | Moves focus (the board's tab stop) to a card, scrolling it into view. |
| `scrollToCard` | `scrollToCard(id: KanbanKey): void;` |  | Scrolls a card into view without focusing it. |
| `openEditor` | `openEditor(id: KanbanKey \| 'new', at?: Partial<KanbanCellRef>): void;` |  | Opens the editor for a card, or a new card in `at` (default: the first column). |
| `closeEditor` | `closeEditor(): void;` |  |  |

### KanbanCancelableEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanCancelableEvent

```ts
interface KanbanCancelableEvent {
    preventDefault(): void;
    readonly defaultPrevented: boolean;
}
```

A cancellable event: `preventDefault()` cancels the built-in action.

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `preventDefault` | `preventDefault(): void;` |  |  |
| `defaultPrevented` | `readonly defaultPrevented: boolean;` |  |  |

### KanbanCardAddEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanCardAddEvent

```ts
interface KanbanCardAddEvent extends KanbanCancelableEvent, KanbanCellRef {
    readonly source: KanbanEventSource;
}
```

`onCardAdd`.

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `source` | `readonly source: KanbanEventSource;` |  |  |
| `preventDefault` | `preventDefault: () => void;` | inherited |  |
| `defaultPrevented` | `defaultPrevented: boolean;` | inherited |  |
| `columnKey` | `columnKey: KanbanKey;` | inherited |  |
| `swimlaneKey` | `swimlaneKey: KanbanKey \| null;` | inherited |  |

### KanbanCardChangeEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanCardChangeEvent

```ts
interface KanbanCardChangeEvent<T> extends KanbanCancelableEvent {
    readonly kind: 'add' | 'update' | 'delete' | 'move';
    readonly card: T;
    readonly cards: readonly T[];
    readonly previous: readonly T[];
    readonly source: KanbanEventSource;
}
```

`onCardChange`: every write the board makes.

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `kind` | `readonly kind: 'add' \| 'update' \| 'delete' \| 'move';` |  |  |
| `card` | `readonly card: T;` |  | The first card (new value; the deleted card for `delete`). |
| `cards` | `readonly cards: readonly T[];` |  |  |
| `previous` | `readonly previous: readonly T[];` |  | Previous values (empty for `add`). |
| `source` | `readonly source: KanbanEventSource;` |  |  |
| `preventDefault` | `preventDefault: () => void;` | inherited |  |
| `defaultPrevented` | `defaultPrevented: boolean;` | inherited |  |

### KanbanCardClickEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanCardClickEvent

```ts
interface KanbanCardClickEvent<T> extends KanbanCancelableEvent {
    readonly card: T;
    readonly id: KanbanKey;
    readonly source: KanbanEventSource;
}
```

`onCardClick`, `onCardDoubleClick`.

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `card` | `readonly card: T;` |  |  |
| `id` | `readonly id: KanbanKey;` |  |  |
| `source` | `readonly source: KanbanEventSource;` |  |  |
| `preventDefault` | `preventDefault: () => void;` | inherited |  |
| `defaultPrevented` | `defaultPrevented: boolean;` | inherited |  |

### KanbanCardContext

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanCardContext

```ts
interface KanbanCardContext<T> {
    readonly card: T;
    readonly id: KanbanKey;
    readonly columnKey: KanbanKey;
    readonly swimlaneKey: KanbanKey | null;
    readonly index: number;
    readonly selected: boolean;
}
```

`renderCard`, `getCardProps` and tooltip argument.

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `card` | `readonly card: T;` |  |  |
| `id` | `readonly id: KanbanKey;` |  |  |
| `columnKey` | `readonly columnKey: KanbanKey;` |  |  |
| `swimlaneKey` | `readonly swimlaneKey: KanbanKey \| null;` |  | `null` without swimlanes or in the unassigned lane. |
| `index` | `readonly index: number;` |  | Position in its cell (0-based). |
| `selected` | `readonly selected: boolean;` |  |  |

### KanbanCardFields

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanCardFields

```ts
interface KanbanCardFields {
    readonly headerField?: string | undefined;
    readonly contentField?: string | undefined;
    readonly tagsField?: string | undefined;
    readonly accentField?: string | undefined;
}
```

Default card fields.

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `headerField` | `readonly headerField?: string \| undefined;` | optional |  |
| `contentField` | `readonly contentField?: string \| undefined;` | optional |  |
| `tagsField` | `readonly tagsField?: string \| undefined;` | optional | Comma-separated string or string array. |
| `accentField` | `readonly accentField?: string \| undefined;` | optional | A CSS color (data color, used as given) for the card's accent edge. |

### KanbanCardMoveEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanCardMoveEvent

```ts
interface KanbanCardMoveEvent<T> extends KanbanCancelableEvent {
    readonly cardId: KanbanKey;
    readonly cardIds: readonly KanbanKey[];
    readonly cards: readonly T[];
    readonly from: KanbanCellRef;
    readonly to: KanbanCellRef;
    readonly index: number;
    readonly source: KanbanEventSource;
    readonly external: 'in' | 'out' | null;
}
```

`onCardMove`.

Members (10):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `cardId` | `readonly cardId: KanbanKey;` |  | The first moved card. |
| `cardIds` | `readonly cardIds: readonly KanbanKey[];` |  |  |
| `cards` | `readonly cards: readonly T[];` |  | Moved cards before the move. |
| `from` | `readonly from: KanbanCellRef;` |  |  |
| `to` | `readonly to: KanbanCellRef;` |  |  |
| `index` | `readonly index: number;` |  | Insertion index among the other cards of the target cell. |
| `source` | `readonly source: KanbanEventSource;` |  |  |
| `external` | `readonly external: 'in' \| 'out' \| null;` |  | `'in'` on the receiving board and `'out'` on the source board of a drop between boards. |
| `preventDefault` | `preventDefault: () => void;` | inherited |  |
| `defaultPrevented` | `defaultPrevented: boolean;` | inherited |  |

### KanbanCardProps

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanCardProps

```ts
interface KanbanCardProps {
    readonly className?: string | undefined;
    readonly style?: CSSProperties | undefined;
    readonly title?: string | undefined;
    readonly [data: `data-${string}`]: string | number | boolean | undefined;
}
```

Pure per-card props from `getCardProps`.

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `className` | `readonly className?: string \| undefined;` | optional |  |
| `style` | `readonly style?: CSSProperties \| undefined;` | optional |  |
| `title` | `readonly title?: string \| undefined;` | optional |  |

### KanbanCellRef

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanCellRef

```ts
interface KanbanCellRef {
    readonly columnKey: KanbanKey;
    readonly swimlaneKey: KanbanKey | null;
}
```

A cell position: column and swimlane.

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columnKey` | `readonly columnKey: KanbanKey;` |  |  |
| `swimlaneKey` | `readonly swimlaneKey: KanbanKey \| null;` |  |  |

### KanbanChangeDetails

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanChangeDetails

```ts
interface KanbanChangeDetails {
    readonly source: KanbanEventSource;
}
```

Second argument of the triad callbacks.

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `source` | `readonly source: KanbanEventSource;` |  |  |

### KanbanColumnContext

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanColumnContext

```ts
interface KanbanColumnContext {
    readonly key: KanbanKey;
    readonly header: string;
    readonly count: number;
    readonly collapsed: boolean;
    readonly limit: KanbanLimitState;
}
```

`renderHeader` argument.

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `key` | `readonly key: KanbanKey;` |  |  |
| `header` | `readonly header: string;` |  |  |
| `count` | `readonly count: number;` |  |  |
| `collapsed` | `readonly collapsed: boolean;` |  |  |
| `limit` | `readonly limit: KanbanLimitState;` |  |  |

### KanbanColumnDef

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanColumnDef

```ts
interface KanbanColumnDef {
    readonly key?: KanbanKey | undefined;
    readonly keys?: readonly KanbanKey[] | undefined;
    readonly header: string;
    readonly collapsible?: boolean | undefined;
    readonly count?: boolean | undefined;
    readonly renderHeader?: ((ctx: KanbanColumnContext) => ReactNode) | undefined;
    readonly min?: number | undefined;
    readonly max?: number | undefined;
    readonly addButton?: boolean | undefined;
    readonly draggable?: boolean | undefined;
    readonly droppable?: boolean | undefined;
    readonly allowedTargets?: readonly KanbanKey[] | undefined;
    readonly hidden?: boolean | undefined;
    readonly className?: string | undefined;
}
```

One column of the board.

Members (14):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `key` | `readonly key?: KanbanKey \| undefined;` | optional | Column value that maps a card to this column (the `columnField` value). |
| `keys` | `readonly keys?: readonly KanbanKey[] \| undefined;` | optional | Several column values shown in one column; moves write the first. |
| `header` | `readonly header: string;` |  | Header text; also the accessible name of the column. |
| `collapsible` | `readonly collapsible?: boolean \| undefined;` | optional | Shows the collapse toggle (default false). |
| `count` | `readonly count?: boolean \| undefined;` | optional | Shows the card count in the header (default true). |
| `renderHeader` | `readonly renderHeader?: ((ctx: KanbanColumnContext) => ReactNode) \| undefined;` | optional | Replaces the header text content. Pure; the toggle, count and add button stay. |
| `min` | `readonly min?: number \| undefined;` | optional | WIP minimum. |
| `max` | `readonly max?: number \| undefined;` | optional | WIP maximum. |
| `addButton` | `readonly addButton?: boolean \| undefined;` | optional | Shows an add button at the end of every cell of the column. |
| `draggable` | `readonly draggable?: boolean \| undefined;` | optional | Cards may be dragged out of this column (default true). |
| `droppable` | `readonly droppable?: boolean \| undefined;` | optional | Cards may be dropped into this column (default true). |
| `allowedTargets` | `readonly allowedTargets?: readonly KanbanKey[] \| undefined;` | optional | Columns that cards of this column may move to (default: every droppable column). |
| `hidden` | `readonly hidden?: boolean \| undefined;` | optional | Hides the column. |
| `className` | `readonly className?: string \| undefined;` | optional |  |

### KanbanColumnGroup

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanColumnGroup

```ts
interface KanbanColumnGroup {
    readonly header: string;
    readonly columns: readonly KanbanKey[];
}
```

A stacked header over consecutive columns.

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `header` | `readonly header: string;` |  |  |
| `columns` | `readonly columns: readonly KanbanKey[];` |  |  |

### KanbanColumnProps

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanColumnProps

```ts
interface KanbanColumnProps extends Omit<KanbanColumnDef, 'key'> {
    readonly columnKey?: KanbanKey | undefined;
}
```

Props of `KanbanColumn`: a column declared as an element (`columnKey` stands for `key`, which React reserves).

Members (14):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columnKey` | `readonly columnKey?: KanbanKey \| undefined;` | optional |  |
| `keys` | `keys?: readonly KanbanKey[];` | optional, inherited | Several column values shown in one column; moves write the first. |
| `header` | `header: string;` | inherited | Header text; also the accessible name of the column. |
| `collapsible` | `collapsible?: boolean;` | optional, inherited | Shows the collapse toggle (default false). |
| `count` | `count?: boolean;` | optional, inherited | Shows the card count in the header (default true). |
| `renderHeader` | `renderHeader?: ((ctx: KanbanColumnContext) => ReactNode);` | optional, inherited | Replaces the header text content. Pure; the toggle, count and add button stay. |
| `min` | `min?: number;` | optional, inherited | WIP minimum. |
| `max` | `max?: number;` | optional, inherited | WIP maximum. |
| `addButton` | `addButton?: boolean;` | optional, inherited | Shows an add button at the end of every cell of the column. |
| `draggable` | `draggable?: boolean;` | optional, inherited | Cards may be dragged out of this column (default true). |
| `droppable` | `droppable?: boolean;` | optional, inherited | Cards may be dropped into this column (default true). |
| `allowedTargets` | `allowedTargets?: readonly KanbanKey[];` | optional, inherited | Columns that cards of this column may move to (default: every droppable column). |
| `hidden` | `hidden?: boolean;` | optional, inherited | Hides the column. |
| `className` | `className?: string;` | optional, inherited |  |

### KanbanDataSource

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanDataSource

```ts
interface KanbanDataSource<T> {
    read(request: DataSourceRequest): DataSourceResult<T> | Promise<DataSourceResult<T>>;
    write?(request: WriteRequest<T>): Promise<WriteResult<T>>;
    subscribe?(listener: (event: unknown) => void): () => void;
}
```

A remote or local `@salmonui/data` source (the structural `DataSource` contract).

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `read` | `read(request: DataSourceRequest): DataSourceResult<T> \| Promise<DataSourceResult<T>>;` |  |  |
| `write` | `write?(request: WriteRequest<T>): Promise<WriteResult<T>>;` | optional |  |
| `subscribe` | `subscribe?(listener: (event: unknown) => void): () => void;` | optional |  |

### KanbanDropTarget

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanDropTarget

```ts
interface KanbanDropTarget<T> {
    readonly ref: RefObject<Element | null>;
    accept?(cards: readonly T[]): boolean;
    onDrop(event: KanbanExternalDropEvent<T>): void;
}
```

An external drop target: an element outside the board that accepts cards.

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `ref` | `readonly ref: RefObject<Element \| null>;` |  |  |
| `accept` | `accept?(cards: readonly T[]): boolean;` | optional | Accepts or refuses the dragged cards (default: accepts). |
| `onDrop` | `onDrop(event: KanbanExternalDropEvent<T>): void;` |  | `preventDefault()` keeps the cards on the board; otherwise they are removed (a `delete` write). |

### KanbanEditorContext

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanEditorContext

```ts
interface KanbanEditorContext<T> {
    readonly card: T;
    readonly isNew: boolean;
    save(next: T): void;
    cancel(): void;
    delete(): void;
}
```

`renderEditor` argument.

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `card` | `readonly card: T;` |  | The edited card, or the draft of a new card. |
| `isNew` | `readonly isNew: boolean;` |  |  |
| `save` | `save(next: T): void;` |  |  |
| `cancel` | `cancel(): void;` |  |  |
| `delete` | `delete(): void;` |  | Deletes the edited card (no-op for a new card). |

### KanbanEditorField

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanEditorField

```ts
interface KanbanEditorField<T> {
    readonly field: string;
    readonly label: string;
    readonly kind?: 'text' | 'select' | 'number' | 'textarea' | undefined;
    readonly options?: readonly {
        readonly value: KanbanKey;
        readonly label: string;
    }[] | undefined;
    readonly required?: boolean | undefined;
    readonly validate?: ((value: unknown, draft: T) => string | null | undefined) | undefined;
}
```

A field of the built-in editor.

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `field` | `readonly field: string;` |  |  |
| `label` | `readonly label: string;` |  |  |
| `kind` | `readonly kind?: 'text' \| 'select' \| 'number' \| 'textarea' \| undefined;` | optional |  |
| `options` | `readonly options?: readonly {     readonly value: KanbanKey;     readonly label: string; }[] \| undefined;` | optional | Options of a `select` field (default for the column and swimlane fields: the columns and lanes). |
| `required` | `readonly required?: boolean \| undefined;` | optional |  |
| `validate` | `readonly validate?: ((value: unknown, draft: T) => string \| null \| undefined) \| undefined;` | optional | Returns an error message, or nothing when the value is valid. |

### KanbanExternalDropEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanExternalDropEvent

```ts
interface KanbanExternalDropEvent<T> extends KanbanCancelableEvent {
    readonly cardIds: readonly KanbanKey[];
    readonly cards: readonly T[];
    readonly target: Element;
    readonly clientX: number;
    readonly clientY: number;
}
```

`KanbanDropTarget.onDrop` argument.

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `cardIds` | `readonly cardIds: readonly KanbanKey[];` |  |  |
| `cards` | `readonly cards: readonly T[];` |  |  |
| `target` | `readonly target: Element;` |  | The element under the pointer, inside the target. |
| `clientX` | `readonly clientX: number;` |  |  |
| `clientY` | `readonly clientY: number;` |  |  |
| `preventDefault` | `preventDefault: () => void;` | inherited |  |
| `defaultPrevented` | `defaultPrevented: boolean;` | inherited |  |

### KanbanLocaleText

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanLocaleText

```ts
interface KanbanLocaleText {
    readonly board: string;
    readonly card: string;
    readonly count: string;
    readonly limitMin: string;
    readonly limitMax: string;
    readonly overLimit: string;
    readonly underLimit: string;
    readonly collapse: string;
    readonly expand: string;
    readonly addCard: string;
    readonly add: string;
    readonly unassigned: string;
    readonly empty: string;
    readonly loading: string;
    readonly loadError: string;
    readonly writeError: string;
    readonly dragInstructions: string;
    readonly lifted: string;
    readonly position: string;
    readonly dropped: string;
    readonly cancelled: string;
    readonly columnPicker: string;
    readonly moveColumn: string;
    readonly columnMoved: string;
    readonly editTitle: string;
    readonly newTitle: string;
    readonly save: string;
    readonly cancel: string;
    readonly delete: string;
    readonly required: string;
    readonly fieldHeader: string;
    readonly fieldContent: string;
    readonly fieldColumn: string;
    readonly fieldSwimlane: string;
}
```

Static texts of `Kanban`; `{param}` templates. Plain JSON, safe to pass from a server component.

Members (34):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `board` | `readonly board: string;` |  | `aria-roledescription` of the board grid. |
| `card` | `readonly card: string;` |  | `aria-roledescription` of a card. |
| `count` | `readonly count: string;` |  | `{count}`: accessible card count of a column or swimlane. |
| `limitMin` | `readonly limitMin: string;` |  | `{min}`: WIP minimum shown in the column header. |
| `limitMax` | `readonly limitMax: string;` |  | `{max}`: WIP maximum shown in the column header. |
| `overLimit` | `readonly overLimit: string;` |  | `{column}`, `{max}`, `{count}`: announced when a column goes over its maximum. |
| `underLimit` | `readonly underLimit: string;` |  | `{column}`, `{min}`, `{count}`: announced when a column goes under its minimum. |
| `collapse` | `readonly collapse: string;` |  | `{column}` |
| `expand` | `readonly expand: string;` |  | `{column}` |
| `addCard` | `readonly addCard: string;` |  | `{column}`: accessible name of an add button. |
| `add` | `readonly add: string;` |  | Visible text of an add button. |
| `unassigned` | `readonly unassigned: string;` |  |  |
| `empty` | `readonly empty: string;` |  |  |
| `loading` | `readonly loading: string;` |  |  |
| `loadError` | `readonly loadError: string;` |  |  |
| `writeError` | `readonly writeError: string;` |  |  |
| `dragInstructions` | `readonly dragInstructions: string;` |  | Description of every draggable card. |
| `lifted` | `readonly lifted: string;` |  | `{card}`, `{position}` |
| `position` | `readonly position: string;` |  | `{column}`, `{lane}`, `{index}`, `{count}` (`{lane}` is empty without swimlanes). |
| `dropped` | `readonly dropped: string;` |  | `{card}`, `{position}` |
| `cancelled` | `readonly cancelled: string;` |  | `{card}` |
| `columnPicker` | `readonly columnPicker: string;` |  | Mobile column picker label. |
| `moveColumn` | `readonly moveColumn: string;` |  | `{column}`: the column grip button with `columnsReorderable`. |
| `columnMoved` | `readonly columnMoved: string;` |  | `{column}`, `{index}`, `{count}` |
| `editTitle` | `readonly editTitle: string;` |  |  |
| `newTitle` | `readonly newTitle: string;` |  |  |
| `save` | `readonly save: string;` |  |  |
| `cancel` | `readonly cancel: string;` |  |  |
| `delete` | `readonly delete: string;` |  |  |
| `required` | `readonly required: string;` |  | `{label}` |
| `fieldHeader` | `readonly fieldHeader: string;` |  | Labels of the default editor fields. |
| `fieldContent` | `readonly fieldContent: string;` |  |  |
| `fieldColumn` | `readonly fieldColumn: string;` |  |  |
| `fieldSwimlane` | `readonly fieldSwimlane: string;` |  |  |

### KanbanProps

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanProps

```ts
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;
}
```

Members (48):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `data` | `readonly 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. |
| `getCardId` | `readonly getCardId: (card: T) => KanbanKey;` |  |  |
| `columnField` | `readonly columnField: string;` |  | Card field that holds the column key. |
| `columns` | `readonly columns?: readonly KanbanColumnDef[] \| undefined;` | optional |  |
| `children` | `readonly children?: ReactNode;` | optional | `KanbanColumn` elements: the declarative alternative to `columns`. |
| `showEmptyColumns` | `readonly showEmptyColumns?: boolean \| undefined;` | optional | Shows columns without cards (default true). |
| `collapsedColumns` | `readonly collapsedColumns?: readonly KanbanKey[] \| undefined;` | optional |  |
| `defaultCollapsedColumns` | `readonly defaultCollapsedColumns?: readonly KanbanKey[] \| undefined;` | optional |  |
| `onCollapsedColumnsChange` | `readonly onCollapsedColumnsChange?: ((value: readonly KanbanKey[], details: KanbanChangeDetails) => void) \| undefined;` | optional |  |
| `limitScope` | `readonly limitScope?: 'column' \| 'swimlane' \| undefined;` | optional | WIP limits count per column (default) or per swimlane cell. |
| `columnGroups` | `readonly columnGroups?: readonly KanbanColumnGroup[] \| undefined;` | optional |  |
| `swimlanes` | `readonly swimlanes?: KanbanSwimlanes \| undefined;` | optional |  |
| `card` | `readonly card?: KanbanCardFields \| undefined;` | optional |  |
| `renderCard` | `readonly renderCard?: ((ctx: KanbanCardContext<T>) => ReactNode) \| undefined;` | optional | Replaces the card body. Pure; called for rendered cards only. |
| `cardHeight` | `readonly cardHeight?: number \| 'auto' \| undefined;` | optional | Fixed card height in px, or `'auto'` (default) for measured heights. |
| `getCardProps` | `readonly getCardProps?: ((ctx: KanbanCardContext<T>) => KanbanCardProps \| undefined) \| undefined;` | optional |  |
| `selection` | `readonly selection?: 'none' \| 'single' \| 'multiple' \| undefined;` | optional | Default `'single'`. |
| `selectedCards` | `readonly selectedCards?: readonly KanbanKey[] \| undefined;` | optional |  |
| `defaultSelectedCards` | `readonly defaultSelectedCards?: readonly KanbanKey[] \| undefined;` | optional |  |
| `onSelectedCardsChange` | `readonly onSelectedCardsChange?: ((value: readonly KanbanKey[], details: KanbanChangeDetails) => void) \| undefined;` | optional |  |
| `sort` | `readonly sort?: KanbanSort<T> \| undefined;` | optional |  |
| `filter` | `readonly filter?: ((card: T) => boolean) \| undefined;` | optional | Client-side card filter (pure). |
| `query` | `readonly query?: KanbanQuery \| undefined;` | optional | Base query of source reads; a new identity re-reads, so memoize it (as `data` for a source). |
| `loading` | `readonly loading?: boolean \| undefined;` | optional | Forces the loading state. |
| `cardsDraggable` | `readonly cardsDraggable?: boolean \| undefined;` | optional | Enables pointer and keyboard card drag. |
| `onCardMove` | `readonly onCardMove?: ((event: KanbanCardMoveEvent<T>) => void) \| undefined;` | optional |  |
| `dragGroup` | `readonly dragGroup?: string \| undefined;` | optional | Boards with the same group accept each other's cards. |
| `dropTargets` | `readonly dropTargets?: readonly KanbanDropTarget<T>[] \| undefined;` | optional |  |
| `columnsReorderable` | `readonly columnsReorderable?: boolean \| undefined;` | optional | Enables column reorder by pointer and Alt+Arrow keys. |
| `columnOrder` | `readonly columnOrder?: readonly KanbanKey[] \| undefined;` | optional |  |
| `defaultColumnOrder` | `readonly defaultColumnOrder?: readonly KanbanKey[] \| undefined;` | optional |  |
| `onColumnOrderChange` | `readonly onColumnOrderChange?: ((value: readonly KanbanKey[], details: KanbanChangeDetails) => void) \| undefined;` | optional |  |
| `onCardChange` | `readonly onCardChange?: ((event: KanbanCardChangeEvent<T>) => void) \| undefined;` | optional |  |
| `onCardAdd` | `readonly onCardAdd?: ((event: KanbanCardAddEvent) => void) \| undefined;` | optional |  |
| `newCard` | `readonly newCard?: ((at: KanbanCellRef) => T) \| undefined;` | optional | 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. |
| `editor` | `readonly editor?: boolean \| {     readonly fields: readonly KanbanEditorField<T>[]; } \| undefined;` | optional | Built-in editor: `true` edits the card fields, or a field list. |
| `renderEditor` | `readonly renderEditor?: ((ctx: KanbanEditorContext<T>) => ReactNode) \| undefined;` | optional |  |
| `editing` | `readonly editing?: KanbanEditing \| undefined;` | optional |  |
| `defaultEditing` | `readonly defaultEditing?: KanbanEditing \| undefined;` | optional |  |
| `onEditingChange` | `readonly onEditingChange?: ((value: KanbanEditing, details: KanbanChangeDetails) => void) \| undefined;` | optional |  |
| `tooltip` | `readonly tooltip?: boolean \| KanbanTooltip<T> \| undefined;` | optional |  |
| `virtualization` | `readonly virtualization?: boolean \| undefined;` | optional | Per-column card virtualization; ignored with swimlanes. |
| `height` | `readonly height?: number \| string \| undefined;` | optional | Board height (px or CSS length); columns scroll inside it. |
| `onCardClick` | `readonly onCardClick?: ((event: KanbanCardClickEvent<T>) => void) \| undefined;` | optional |  |
| `onCardDoubleClick` | `readonly onCardDoubleClick?: ((event: KanbanCardClickEvent<T>) => void) \| undefined;` | optional | Default action: opens the editor (with `editor`). |
| `onDataError` | `readonly onDataError?: ((error: unknown, kind: 'read' \| 'write') => void) \| undefined;` | optional | Read and write failures of a source (`writeError` reverts the optimistic change). |
| `localeText` | `readonly localeText?: Partial<KanbanLocaleText> \| undefined;` | optional |  |
| `ref` | `readonly ref?: Ref<KanbanApi> \| undefined;` | optional |  |

### KanbanQuery

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanQuery

```ts
interface KanbanQuery {
    readonly filters?: readonly FilterEntry[] | undefined;
    readonly sorting?: readonly SortDescriptor[] | undefined;
}
```

Base query merged into every source read.

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `filters` | `readonly filters?: readonly FilterEntry[] \| undefined;` | optional |  |
| `sorting` | `readonly sorting?: readonly SortDescriptor[] \| undefined;` | optional |  |

### KanbanSort

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanSort

```ts
interface KanbanSort<T> {
    readonly by: 'data' | 'field' | 'custom';
    readonly field?: string | undefined;
    readonly direction?: 'asc' | 'desc' | undefined;
    readonly comparator?: ((a: T, b: T) => number) | undefined;
}
```

Card sort within a cell.

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `by` | `readonly by: 'data' \| 'field' \| 'custom';` |  | `data`: array order (default); `field`: by `field`; `custom`: `comparator`. |
| `field` | `readonly field?: string \| undefined;` | optional |  |
| `direction` | `readonly direction?: 'asc' \| 'desc' \| undefined;` | optional |  |
| `comparator` | `readonly comparator?: ((a: T, b: T) => number) \| undefined;` | optional |  |

### KanbanSwimlaneContext

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanSwimlaneContext

```ts
interface KanbanSwimlaneContext {
    readonly key: KanbanKey | null;
    readonly label: string;
    readonly count: number;
}
```

`swimlanes.renderHeader` argument.

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `key` | `readonly key: KanbanKey \| null;` |  | `null` for the unassigned lane. |
| `label` | `readonly label: string;` |  |  |
| `count` | `readonly count: number;` |  |  |

### KanbanSwimlaneDef

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanSwimlaneDef

```ts
interface KanbanSwimlaneDef {
    readonly key: KanbanKey;
    readonly label?: string | undefined;
}
```

A declared swimlane (order, label, and `showEmpty`).

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `key` | `readonly key: KanbanKey;` |  |  |
| `label` | `readonly label?: string \| undefined;` | optional |  |

### KanbanSwimlanes

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanSwimlanes

```ts
interface KanbanSwimlanes {
    readonly field: string;
    readonly labelField?: string | undefined;
    readonly lanes?: readonly KanbanSwimlaneDef[] | undefined;
    readonly renderHeader?: ((ctx: KanbanSwimlaneContext) => ReactNode) | undefined;
    readonly sort?: 'asc' | 'desc' | ((a: KanbanSwimlaneContext, b: KanbanSwimlaneContext) => number) | undefined;
    readonly showEmpty?: boolean | undefined;
    readonly count?: boolean | undefined;
    readonly unassigned?: boolean | undefined;
    readonly sticky?: boolean | undefined;
    readonly draggable?: boolean | undefined;
}
```

Swimlane options.

Members (10):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `field` | `readonly field: string;` |  | Card field holding the swimlane key. |
| `labelField` | `readonly labelField?: string \| undefined;` | optional | Card field holding the lane label (default: the key). |
| `lanes` | `readonly lanes?: readonly KanbanSwimlaneDef[] \| undefined;` | optional | Declared lanes: their order and labels; with `showEmpty` they render without cards. |
| `renderHeader` | `readonly renderHeader?: ((ctx: KanbanSwimlaneContext) => ReactNode) \| undefined;` | optional |  |
| `sort` | `readonly sort?: 'asc' \| 'desc' \| ((a: KanbanSwimlaneContext, b: KanbanSwimlaneContext) => number) \| undefined;` | optional | Lane order: by label, or a comparator (default: declared lanes, then first appearance). |
| `showEmpty` | `readonly showEmpty?: boolean \| undefined;` | optional | Renders declared lanes that have no cards (default false). |
| `count` | `readonly count?: boolean \| undefined;` | optional | Shows the card count in the lane header (default true). |
| `unassigned` | `readonly unassigned?: boolean \| undefined;` | optional | Cards without a lane key go to an "Unassigned" lane (default true); false hides them. |
| `sticky` | `readonly sticky?: boolean \| undefined;` | optional | Lane headers stick to the top while the board scrolls. |
| `draggable` | `readonly draggable?: boolean \| undefined;` | optional | Cards may be dragged across lanes (default false). |

### KanbanTooltip

Kind: interface

Page: https://salmonui.dev/docs/reference/kanban/KanbanTooltip

```ts
interface KanbanTooltip<T> {
    readonly render?: ((ctx: KanbanCardContext<T>) => ReactNode) | undefined;
    readonly delay?: number | undefined;
}
```

Tooltip options.

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `render` | `readonly render?: ((ctx: KanbanCardContext<T>) => ReactNode) \| undefined;` | optional | Tooltip content (default: the header and content fields). |
| `delay` | `readonly delay?: number \| undefined;` | optional | Delay before showing, ms (default 500). |

## Types

### KanbanEditing

Kind: type

Page: https://salmonui.dev/docs/reference/kanban/KanbanEditing

```ts
type KanbanEditing = KanbanKey | 'new' | null;
```

What the editor shows: a card id, `'new'`, or `null` when closed.

### KanbanEventSource

Kind: type

Page: https://salmonui.dev/docs/reference/kanban/KanbanEventSource

```ts
type KanbanEventSource = 'pointer' | 'keyboard' | 'touch' | 'api';
```

Where a change came from.

### KanbanKey

Kind: type

Page: https://salmonui.dev/docs/reference/kanban/KanbanKey

```ts
type KanbanKey = string | number;
```

A card id, column key or swimlane key.

### KanbanLimitState

Kind: type

Page: https://salmonui.dev/docs/reference/kanban/KanbanLimitState

```ts
type KanbanLimitState = 'over' | 'under' | null;
```

WIP state of a column or cell.

## Constants

### KANBAN_DEFAULT_LOCALE_TEXT

Kind: const

Page: https://salmonui.dev/docs/reference/kanban/KANBAN_DEFAULT_LOCALE_TEXT

```ts
const KANBAN_DEFAULT_LOCALE_TEXT: KanbanLocaleText;
```
