Skip to Content
Reference<VueFlow />

<VueFlow />

Source on Github 

The <VueFlow /> component is the heart of your Vue Flow application.

<script setup lang="ts"> import { shallowRef } from 'vue'; import { VueFlow, type Node, type Edge } from '@xyflow/vue'; import '@xyflow/vue/style.css'; const nodes = shallowRef<Node[]>([ { id: 'a', data: { label: 'node a' }, position: { x: 0, y: 0 } }, { id: 'b', data: { label: 'node b' }, position: { x: 0, y: 100 } } ]); const edges = shallowRef<Edge[]>([ { id: 'e1-2', source: 'a', target: 'b' } ]); </script> <VueFlow :nodes="nodes" :edges="edges" fit-view />

This component takes a lot of different props, most of which are optional. We’ve tried to document them in groups that make sense to help you find your way.

Common props

These are the props you will most commonly use when working with Vue Flow.

NameTypeDefault
...propsHTMLAttributes<HTMLDivElement>

Viewport props

NameTypeDefault
defaultViewportFlowProps
fitViewFlowProps
fitViewOptionsFlowProps
minZoomFlowProps
maxZoomFlowProps
snapGridFlowProps
onlyRenderVisibleElementsFlowProps
translateExtentFlowProps
preventScrollingFlowProps
attributionPositionFlowProps

Node props

NameTypeDefault
nodeOriginFlowProps
nodesDraggableFlowProps
nodesConnectableFlowProps
nodesFocusableFlowProps
nodeDragThresholdFlowProps
nodeClickDistanceFlowProps
nodeExtentFlowProps
elevateNodesOnSelectFlowProps

Edge props

NameTypeDefault
edgesFocusableFlowProps
elevateEdgesOnSelectFlowProps
defaultMarkerColorFlowProps
defaultEdgeOptionsFlowProps

Event handlers

General Events

NameTypeDefault
initFlowProps
errorFlowProps
deleteFlowProps
onBeforeDeleteFlowProps

Node Events

NameTypeDefault
nodeClickFlowProps
nodeDoubleClickFlowProps
nodeMouseEnterFlowProps
nodeMouseMoveFlowProps
nodeMouseLeaveFlowProps
nodeContextMenuFlowProps
nodeDragStartFlowProps
nodeDragFlowProps
nodeDragStopFlowProps

Edge Events

NameTypeDefault
edgeContextMenuFlowProps
edgeMouseEnterFlowProps
edgeMouseMoveFlowProps
edgeMouseLeaveFlowProps
edgeDoubleClickFlowProps
edgeClickFlowProps
reconnectStartFlowProps
reconnectEndFlowProps

Selection Events

NameTypeDefault
selectionChangeFlowProps
selectionContextMenuFlowProps
selectionDragStartFlowProps
selectionDragFlowProps
selectionDragStopFlowProps
selectionStartFlowProps
selectionEndFlowProps

Pane Events

NameTypeDefault
paneClickFlowProps
paneContextMenuFlowProps
paneMouseEnterFlowProps
paneMouseMoveFlowProps
paneMouseLeaveFlowProps
paneScrollFlowProps

Connection Events

NameTypeDefault
connectFlowProps
connectStartFlowProps
connectEndFlowProps
isValidConnectionFlowProps
clickConnectStartFlowProps
clickConnectEndFlowProps

Connection line props

NameTypeDefault
connectionRadiusFlowProps
connectionDragThresholdFlowProps
connectionLineOptionsFlowProps

Interaction props

NameTypeDefault
elementsSelectableFlowProps
autoPanOnConnectFlowProps
autoPanOnNodeDragFlowProps
autoPanOnSelectionFlowProps
selectNodesOnDragFlowProps
panOnDragFlowProps
selectionOnDragFlowProps
selectionModeFlowProps
panOnScrollFlowProps
panOnScrollModeFlowProps
panOnScrollSpeedFlowProps
zoomOnScrollFlowProps
zoomOnPinchFlowProps
zoomOnDoubleClickFlowProps
connectionModeFlowProps
paneClickDistanceFlowProps
zIndexModeFlowProps

Keyboard props

NameTypeDefault
deleteKeyCodeFlowProps
selectionKeyCodeFlowProps
multiSelectionKeyCodeFlowProps
zoomActivationKeyCodeFlowProps
panActivationKeyCodeFlowProps
disableKeyboardA11yFlowProps

Style props

Applying certain classes to elements rendered inside the canvas will change how interactions are handled. These props let you configure those class names if you need to.

NameTypeDefault
noPanClassNameFlowProps
noDragClassNameFlowProps
noWheelClassNameFlowProps

Notes

  • The props of this component get exported as VueFlowProps
Last updated on