Skip to main content

getReactiveState

Returns a reactive ref for each field of the Kanban state. A subscription to a ref 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 ref for each state field:

FieldTypeDescription
cardsCardsStoreInternal card storage
columnsColumnConfig[]Column definitions in board order
columnAccessorColumnAccessorResolver for card-to-column membership
swimlanesSwimlaneConfig[]Swimlane definitions in board order; empty without swimlanes (PRO)
swimlaneAccessorSwimlaneAccessorResolver for card-to-swimlane membership (PRO)
filtersMap<string, FilterPredicate>Active filter predicates keyed by tag
sortSortCriterionActive sort criterion, or null
editorDataKanbanCard | nullCurrently selected card, or null
dynamicDatabooleanWhether dynamic loading is on
columnDataMap<ColumnID, { status: ColumnDataStatus }>Per-column load state ("unknown", "loading", or "loaded")
history{ undo: number; redo: number }Available undo/redo step counts
viewDataKanbanModelProjected render model: ordered, filtered, sorted columns plus the swimlanes array
renderModestring"" for normal rendering, "export" while the board renders for export

Each field is a Vue reactive value. Reading it inside a reactive context (computed, watchEffect) sets up automatic tracking.

Example​

<script setup>
import { ref, computed } from "vue";
import { Kanban } from "@svar-ui/vue-kanban";

const api = ref();

function init(kanbanApi) {
api.value = kanbanApi;
}

const state = computed(() => api.value?.getReactiveState());
const selected = computed(() => state.value?.editorData.v);
</script>

<template>
<Kanban :init="init" :cards="cards" :columns="columns" />

<p>Selected card: {{ selected?.label ?? "none" }}</p>
</template>
  • getState - non-reactive snapshot of current state
  • getCards - unfiltered source card array