getState
Returns a plain object with the current values of all state fields. The snapshot isn't reactive - reading it inside a reactive context won't trigger updates. For live subscriptions, use getReactiveState().
Usage
getState(): State
| Field | Type | Description |
|---|---|---|
renderMode | string | "" for normal rendering, "export" while the board renders for export |
cards | CardsStore | Internal card storage with CRUD methods |
columns | ColumnConfig[] | Column definitions in board order (inferred from cards when the columns prop is omitted) |
columnAccessor | ColumnAccessor | Resolver for card-to-column membership |
swimlanes | SwimlaneConfig[] | Swimlane definitions in board order (inferred from cards when the swimlanes prop is omitted); empty on an ordinary board (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 enabled |
columnData | Map<ColumnID, { status: ColumnDataStatus }> | Per-column load state ("unknown", "loading", "loaded") |
history | { undo: number; redo: number } | Available undo/redo step counts |
viewData | { columns: ColumnView[]; swimlanes: SwimlaneView[] } | Projected render model (filtered, sorted columns and swimlanes with cards) |
Example
<script setup>
import { Kanban } from "@svar-ui/vue-kanban";
import { ref } from "vue";
const api = ref(null);
function logState() {
const state = api.value.getState();
console.log("columns:", state.columns);
console.log("selected card:", state.editorData);
}
</script>
<template>
<Kanban :cards="cards" :columns="columns" ref="api" />
<button :onclick="logState">Log state</button>
</template>
Related
- getReactiveState - reactive composables for live subscriptions
- getCards - unfiltered source card array
- getStores - raw store instances (escape hatch)