getReactiveState
Returns a reactive store for each field of the Kanban state. A subscription to a store re-runs dependent logic whenever that field changes. For a one-time snapshot, use getState().
Usage
getReactiveState(): TState<State>
The returned object contains a reactive store for each state field:
| Field | Type | Description |
|---|---|---|
cards | CardsStore | Internal card storage |
columns | ColumnConfig[] | Column definitions in board order |
columnAccessor | ColumnAccessor | Resolver for card-to-column membership |
swimlanes | SwimlaneConfig[] | Swimlane definitions in board order; empty without swimlanes (PRO) |
swimlaneAccessor | SwimlaneAccessor | Resolver for card-to-swimlane membership (PRO) |
filters | Map<string, FilterPredicate> | Active filter predicates keyed by tag |
sort | SortCriterion | Active sort criterion, or null |
editorData | KanbanCard | null | Currently selected card, or null |
dynamicData | boolean | Whether dynamic loading is on |
columnData | Map<ColumnID, { status: ColumnDataStatus }> | Per-column load state ("unknown", "loading", or "loaded") |
history | { undo: number; redo: number } | Available undo/redo step counts |
viewData | KanbanModel | Projected render model: ordered, filtered, sorted columns plus the swimlanes array |
renderMode | string | "" for normal rendering, "export" while the board renders for export |
Each field is a Svelte store. Read it with the $ prefix ($editorData) or subscribe to it to track changes.
Example
<script>
import { Kanban } from "@svar-ui/svelte-kanban";
let selected = $state(null);
function init(api) {
const { editorData } = api.getReactiveState();
editorData.subscribe(card => (selected = card));
}
</script>
<Kanban {init} {cards} {columns} />
<p>Selected card: {selected?.label ?? "none"}</p>