Examples
Browse our examples for practical copy-paste solutions to common use cases with React Flow. Here you can find our MIT Licensed examples, which you are free to use in your projects without restrictions, as well as our Pro examples that come with our React Flow Pro subscription plans.
Nodes
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fadd-node-on-edge-drop%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
NODES
A new node appears wherever you drop the connection line
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fconnection-limit%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
NODES
Use the `isConnectable` prop to limit the number of connections a handle can have
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fcustom-node%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
NODES
Display any content inside of a node
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fdelete-middle-node%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
NODES
Remove a node without breaking the flow
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fdrag-handle%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
NODES
Restrict dragging to a specific part of node
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Feasy-connect%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
NODES
Make the whole node into a handle
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fintersections%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
NODES
Detect when a node overlaps with another node
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fnode-resizer%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
NODES
Change the size of a node with a bounding box or draggable icon
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fproximity-connect%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
NODES
Automatically create edges when nodes get close to each other
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fstress%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
NODES
Render hundreds of nodes and edges at once
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fupdate-node%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
NODES
Update the data field of a specific node
Edges
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Fcustom-connectionline%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
EDGES
Create a custom connection line while dragging
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Fcustom-edges%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
EDGES
Create and use custom edge types
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Fedge-labels%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
EDGES
Add and customize labels on edges
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Fedge-markers%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
EDGES
Add markers to the start and end of edges
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Fedge-types%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
EDGES
Use different built-in edge types
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Ffloating-edges%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
EDGES
Create edges that connect to the viewport
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Freconnect-edge%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
EDGES
Make edge reconnectable by using EdgeReconnectAnchor.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Fclick-connect%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
EDGES
Create a new connection by clicking on a handle one by one. Use this functionality to programatically start a connection.
Interaction
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Finteraction%2Fcomputing-flows%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
INTERACTION
Calculate and visualize flow paths between nodes
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Finteraction%2Fcontext-menu%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
INTERACTION
Add a custom context menu to nodes and edges
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Finteraction%2Fcontextual-zoom%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
INTERACTION
Zoom to specific nodes or areas of the flow
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Finteraction%2Fdrag-and-drop%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
INTERACTION
Drag and drop outside of the Svelte Flow pane with native HTML Drag and Drop API or svelte-draggable.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Finteraction%2Fvalidation%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
INTERACTION
Check if a new connection is valid and should be added
Layout
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Flayout%2Fdagre%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
LAYOUT
Use Dagre for hierarchical graph layout
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Flayout%2Felkjs%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
LAYOUT
Use ELK.js for automatic graph layout
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Flayout%2Fhorizontal-flow%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
LAYOUT
Create a horizontal flow layout
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Flayout%2Fsubflows%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
LAYOUT
Create nested flows within your graph
Styling
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fstyling%2Fbase-style%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
STYLING
Customize the base styling of your flow
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fstyling%2Fdark-mode%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
STYLING
Implement dark mode in your flow
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fstyling%2Ftailwind%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
STYLING
Style your flow with Tailwind CSS
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fstyling%2Fturbo-flow%2Fpreview.jpg%3Fv%3D1&w=3840&q=75)
STYLING
Nodes with glowing animated gradient borders, inspired by the turbo.build website