Skip to Content
Vue Flow v2 is here and joins xyflow! Read more here →
ReferenceComposables

useVueFlowStore()

Source on GitHub 

The useVueFlowStore composable returns the raw reactive state of the flow. Where useVueFlow() gives you a curated set of actions and getters, useVueFlowStore gives you the underlying reactive fields directly — nodes, edges, transform, nodeLookup, connectionLookup, and so on. Read them straight off the returned object (no .value), the same way you’d read a Pinia store.

<script setup lang="ts"> import { useVueFlowStore } from '@xyflow/vue'; const store = useVueFlowStore(); // read reactive state directly console.log(store.transform, store.nodeLookup.size); </script>

Signature

Parameters:

This function does not accept any parameters.

Returns:
VueFlowState<NodeType, EdgeType>

the reactive state for the current context

Notes

  • Prefer useVueFlow() for most work — reach for useVueFlowStore only when you need a raw store field that isn’t exposed as a getter.
  • To destructure value fields into refs without losing reactivity, pass the store through storeToRefs(). The map-like lookups (nodeLookup, edgeLookup, parentLookup, connectionLookup) can be destructured directly.
  • Like the other composables, useVueFlowStore throws when used outside a flow provider.