Skip to content

Flow Chart

Flow is a high-performance general-purpose flow chart/node editor component using a hybrid rendering architecture (SVG + Canvas + Virtual Scrolling), supporting 10,000+ nodes.

Features

  • High-performance rendering: Supports 10,000+ nodes with virtual scrolling + incremental updates.
  • Hybrid rendering architecture: Nodes are rendered as Vue components, edges are rendered with SVG, and the background with Canvas.
  • Rich interaction: Node dragging, edge creation, box selection, and keyboard shortcuts.
  • Complete plugin system: Built-in plugins like Minimap, Controls, Grid, Snap, Export, etc.
  • Flexible extension: Support for custom nodes, custom edges, and nested nodes.
  • TypeScript Support: Complete type definitions and generic support.

Installation

bash
npm install @yh-ui/flow

Basic Usage

Input Node
Process Node
Output Node
Basic Usage

With Controls and Minimap

Branch 1
Branch 2
Start
Process A
Process B
End
Controls & Minimap

Interaction

  • Pan Viewport: Click and drag on empty space, or use the mouse wheel.
  • Zoom: Use the mouse wheel or Ctrl + wheel.
  • Select Nodes: Click a node, or use Shift + click for multiple selection.
  • Box Selection: Press Alt/Option and drag to box select.
  • Connect Nodes: Drag from a handle on one node to another.
  • Delete: Press the Delete key when a node or edge is selected.
  • Undo/Redo: Ctrl + Z / Ctrl + Shift + Z.

Props

PropTypeDefaultDescription
nodesNode[][]Node data
edgesEdge[][]Edge data
modelValueViewportTransform{ x: 0, y: 0, zoom: 1 }Viewport transform
minZoomnumber0.1Minimum zoom level
maxZoomnumber5Maximum zoom level
zoomStepnumber0.1Zoom step size
nodesDraggablebooleantrueWhether nodes can be dragged
edgesConnectablebooleantrueWhether edges can be connected
selectablebooleantrueWhether items are selectable
background'none' | 'dots' | 'grid''dots'Background type
backgroundColorstring-Background color
gridSizenumber15Grid size
snapToGridbooleanfalseWhether to snap to grid
snapGrid[number, number][15, 15]Grid snap size
readonlybooleanfalseWhether the editor is read-only
showControlsbooleanfalseWhether to show control bar
showMinimapbooleanfalseWhether to show minimap
minimapNodeColorstring-Node color in minimap
showAlignmentLinesbooleantrueWhether to show alignment lines
snapThresholdnumber10Node snapping threshold
historybooleantrueWhether to enable history
maxHistorynumber50Maximum history items
keyboardShortcutsbooleantrueWhether to enable keyboard shortcuts

Events

EventParametersDescription
update:modelValue(value: ViewportTransform)Triggered when viewport changes
update:nodes(nodes: Node[])Triggered when nodes change
update:edges(edges: Edge[])Triggered when edges change
nodeClick{ node: Node; nativeEvent: MouseEvent }Node clicked
nodeDblClick{ node: Node; nativeEvent: MouseEvent }Node double-clicked
nodeDragStart{ node: Node; nativeEvent: MouseEvent }Node drag start
nodeDrag{ node: Node; nativeEvent: MouseEvent; position: { x: number; y: number } }Node dragging
nodeDragEnd{ node: Node; nativeEvent: MouseEvent }Node drag end
nodeContextMenu{ node: Node; nativeEvent: MouseEvent }Node context menu
edgeClick{ edge: Edge; nativeEvent: MouseEvent }Edge clicked
edgeDblClick{ edge: Edge; nativeEvent: MouseEvent }Edge double-clicked
edgeContextMenu{ edge: Edge; nativeEvent: MouseEvent }Edge context menu
edgeConnectConnectionEdge connected successfully
selectionChange{ selectedNodes: Node[]; selectedEdges: Edge[] }Selection changed
historyChange{ canUndo: boolean; canRedo: boolean }History change
viewportChangeViewportTransformViewport transform change

Note: If you need to implement "Delete Selected", toolbars that show based on selection, etc., please listen to @selection-change and update local state (like selected ID sets) based on selectedNodes / selectedEdges.

Next

Released under the MIT License.