VueFlow component is the core container that renders your interactive node graph. It manages nodes, edges, viewport, and all user interactions.
Installation
Basic Usage
Props
Model Binding
All elements (nodes + edges). Deprecated: Use
nodes and edges props instead.Array of nodes to render in the flow.
Array of edges to render in the flow.
Element Types
Custom node type components. Either use this prop or use slots (
<template #node-custom="props">)Custom edge type components. Either use this prop or use slots (
<template #edge-custom="props">)Interaction
Enable/disable node dragging globally.
Enable/disable creating connections from nodes.
Enable/disable selecting elements.
Select nodes when dragging.
Enable panning by dragging. Can specify mouse buttons as array.
Enable panning by scrolling.
Enable zooming by scrolling.
Enable zooming by pinch gesture.
Enable zooming by double-clicking.
Prevent page scroll when interacting with the flow.
Zoom & Viewport
Minimum zoom level.
Maximum zoom level.
Initial viewport position and zoom.
Boundary area for panning.
Boundary area for node positions.
Automatically fit the view to show all nodes on initialization.
Grid & Snapping
Enable snapping nodes to grid.
Grid size for snapping as
[x, y].Connections
How connections behave:
'strict' or 'loose'.Styling and type options for the connection line.
Radius for detecting connection handles.
Function to validate connections before they are created.
Allow connections using click handlers (useful for touch devices).
Automatically create edges when connections are made. Deprecated.
Keyboard
Key(s) to delete selected elements.
Key(s) to enable selection mode.
Key(s) for multi-selection.
Key(s) to activate panning mode.
Key(s) to activate zoom mode.
Rendering
Only render nodes and edges currently visible in the viewport (performance optimization).
Elevate edges z-index when selected.
Elevate nodes z-index by +1000 when selected.
Edge Options
Enable updating edge connections.
Default options applied to all edges.
Default color for edge markers.
Accessibility
Disable keyboard accessibility features.
Make edges focusable for keyboard navigation.
Make nodes focusable for keyboard navigation.
Auto Pan
Automatically pan when connecting near viewport edges.
Automatically pan when dragging nodes near viewport edges.
Speed of automatic panning.
Other
Unique identifier for this Vue Flow instance.
Apply default change handlers. Deprecated: Will be removed in next major version.
Selection behavior:
'partial' or 'full'.Maximum mouse movement between mousedown/up to trigger a click.
Events
Node Events
Fired when a node is clicked.
Fired when a node is double-clicked.
Fired on node right-click.
Fired when mouse enters a node.
Fired when mouse moves over a node.
Fired when mouse leaves a node.
Fired when node dragging starts.
Fired while dragging a node.
Fired when node dragging stops.
Edge Events
Fired when an edge is clicked.
Fired when an edge is double-clicked.
Fired on edge right-click.
Fired when mouse enters an edge.
Fired when mouse moves over an edge.
Fired when mouse leaves an edge.
Fired when an edge connection is updated.
Fired when edge update starts.
Fired when edge update ends.
Connection Events
Fired when a new connection is created.
Fired when connection creation starts.
Fired when connection creation ends.
Pane Events
Fired when the pane (background) is clicked.
Fired on pane right-click.
Fired when scrolling on the pane.
Fired when mouse enters the pane.
Fired when mouse moves over the pane.
Fired when mouse leaves the pane.
Viewport Events
Fired when the viewport is moved.
Fired when viewport movement starts.
Fired when viewport movement ends.
Fired when viewport changes.
Fired when viewport change starts.
Fired when viewport change ends.
Selection Events
Fired when selection starts.
Fired when selection ends.
Fired when dragging selected nodes starts.
Fired while dragging selected nodes.
Fired when dragging selected nodes stops.
Fired on selection right-click.
State Events
Fired when nodes change (position, selection, etc.).
Fired when edges change.
Fired when all nodes are initialized.
Fired when the Vue Flow instance is initialized.
Fired when an error occurs.
Slots
default
Content rendered outside the viewport (not affected by zoom/pan).
zoom-pane
Content rendered inside the viewport (affected by zoom/pan).
Custom connection line component.
Custom node type component. Replace
{type} with your node type.Custom edge type component. Replace
{type} with your edge type.Complete Example
The VueFlow component provides access to its internal state via the
useVueFlow composable. You can use this to programmatically control the flow, access nodes/edges, and more.