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

Expand and Collapse

This example demonstrates how to implement expandable and collapsible nodes in a hierarchical tree structure. Nodes with children can be expanded or collapsed by clicking on them, revealing or hiding their descendants. The implementation maintains the complete graph structure while only rendering the currently visible portions.

About this Pro Example

  • Dependencies: @xyflow/vue , @dagrejs/dagre 
  • Demonstrates dynamic node addition with automatic layout recalculation
  • Uses node data properties to track expanded/collapsed state
  • Provides interactive controls to expand/collapse nodes and add children
  • License: xyflow Pro License