Skip to Content

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

NODES

Add Node On Edge Drop

A new node appears wherever you drop the connection line

See example
[object Object] screenshot

NODES

Connection Limit

Use the `isConnectable` prop to limit the number of connections a handle can have

See example
[object Object] screenshot

NODES

Custom Nodes

Display any content inside of a node

See example
[object Object] screenshot

NODES

Delete Middle Node

Remove a node without breaking the flow

See example
[object Object] screenshot

NODES

Drag Handle

Restrict dragging to a specific part of node

See example
[object Object] screenshot

NODES

Easy Connect

Make the whole node into a handle

See example
[object Object] screenshot

NODES

Intersections

Detect when a node overlaps with another node

See example
[object Object] screenshot

NODES

Node Resizer

Change the size of a node with a bounding box or draggable icon

See example
[object Object] screenshot

NODES

Node Toolbar

A toolbar with buttons appears next to the selected node

See example
[object Object] screenshot

NODES

Proximity Connect

Automatically create edges when nodes get close to each other

See example
[object Object] screenshot

NODES

Rotatable Node

A custom node that can be rotated using CSS transforms

See example
[object Object] screenshot

NODES

Node Position AnimationPro

Animate smooth transitions between different graph layouts with interactive controls

See example
[object Object] screenshot

NODES

Stress Test

Render hundreds of nodes and edges at once

See example
[object Object] screenshot

NODES

Updating Nodes

Update the data field of a specific node

See example
[object Object] screenshot

NODES

ShapesPro

Render Custom Nodes with different shapes that are commonly used in flow charts

See example

Edges

[object Object] screenshot

EDGES

Animating Edges

Create edge animations that go beyond the built-in animated edge.

See example
[object Object] screenshot

EDGES

Connection Line

Change the appearance and behavior of the connection line

See example
[object Object] screenshot

EDGES

Custom Edges

Create edges with special routing or controls along the edge

See example
[object Object] screenshot

EDGES

Delete Edge on Drop

Delete an edge when it doesn't find a handle

See example
[object Object] screenshot

EDGES

Edge Label Renderer

Render edge labels as divs on top of edges

See example
[object Object] screenshot

EDGES

Edge Intersection

Detect edge intersections with nodes while dragging.

See example
[object Object] screenshot

EDGES

Edge Toolbar

You can use the EdgeToolbar component to display content on top of an edge.

See example
[object Object] screenshot

EDGES

Edge Types

Make edges straight, stepped, smooth-stepped, or bezier curved

See example
[object Object] screenshot

EDGES

Floating Edges

Instead of having the handle at a fixed point, let it move with the connected edge

See example
[object Object] screenshot

EDGES

Edge Markers

Make your edges into arrows, add custom icons, or SVGs

See example
[object Object] screenshot

EDGES

Multi Connection Line

Draw multiple connection lines at once from any selected nodes.

See example
[object Object] screenshot

EDGES

Reconnect Edge

Click-drag to move an existing edge from one handle to another

See example
[object Object] screenshot

EDGES

Simple Floating Edges

Edges connect to the closest available handle

See example
[object Object] screenshot

EDGES

Temporary Edges

Push what React Flow edges are capable of by rendering invisible ghost nodes.

See example
[object Object] screenshot

EDGES

Editable EdgePro

Implement a custom edge with draggable control points to change the path of an edge

See example

Interaction

[object Object] screenshot

INTERACTION

Computing Flows

This examples demonstrates how to use the helpers to handle data flow

See example
[object Object] screenshot

INTERACTION

Connection Events

React Flow emits different events during the connection process. Use this example to get an overview of those events and what order they are called in.

See example
[object Object] screenshot

INTERACTION

Context Menu

Right-click a node to display custom actions

See example
[object Object] screenshot

INTERACTION

Contextual Zoom

Only display the content of a node when you are zoomed in close enough

See example
[object Object] screenshot

INTERACTION

Drag and Drop

Drag and drop outside of the React Flow pane with native HTML Drag and Drop API or react-draggable.

See example
[object Object] screenshot

INTERACTION

Preventing Cycles

Check if a new connection would cause a cycle in the graph

See example
[object Object] screenshot

INTERACTION

Save and Restore

Save the state of the diagram, and reload it after refreshing the page

See example
[object Object] screenshot

INTERACTION

Touch Device

Tap two handles to connect them, and make handles bigger for smaller devices

See example
[object Object] screenshot

INTERACTION

Validation

Check if a new connection is valid and should be added

See example
[object Object] screenshot

INTERACTION

Helper LinesPro

Display lines that help to visually align nodes, with automatic snapping for precise positioning and layout control.

See example
[object Object] screenshot

INTERACTION

CollaborativePro

Build a collaborative graph for multiple users with React Flow and yjs

See example
[object Object] screenshot

INTERACTION

Copy and PastePro

Select nodes and edges to cut, copy, and paste

See example
[object Object] screenshot

INTERACTION

Undo and RedoPro

Undo and redo functionality for moving, adding, and deleting nodes and edges

See example

Subflows & Grouping

[object Object] screenshot

SUBFLOWS & GROUPING

Selection GroupingPro

This example demonstrates how to create dynamic node grouping in React Flow.

See example
[object Object] screenshot

SUBFLOWS & GROUPING

Parent Child RelationPro

Dynamically attach and detach nodes from parent containers with drag and drop functionality

See example
[object Object] screenshot

SUBFLOWS & GROUPING

Sub Flow

Render nested graphs and group nodes, and configure the behavior of child nodes

See example

Layout

[object Object] screenshot

LAYOUT

Dagre Tree

Integrate dagre js with React Flow to create simple tree layouts

See example
[object Object] screenshot

LAYOUT

Elkjs Tree

For a more powerful alternative to dagre, you can also use elkjs to layout your graphs

See example
[object Object] screenshot

LAYOUT

Elkjs Multiple Handles

Use multiple handles with the elkjs layouting engine to reduce edge crossings

See example
[object Object] screenshot

LAYOUT

Horizontal Flow

A diagram that flows from left to right

See example
[object Object] screenshot

LAYOUT

Expand and CollapsePro

Create hierarchical trees with expandable and collapsible nodes using dagre for automatic layouts

See example
[object Object] screenshot

LAYOUT

Auto LayoutPro

Automatically arrange nodes using various layout engines like dagre, d3-hierarchy, or elkjs

See example
[object Object] screenshot

LAYOUT

Force LayoutPro

Newly added nodes never overlap with existing nodes using d3-force

See example
[object Object] screenshot

LAYOUT

Dynamic LayoutingPro

A self-organizing graph where users add nodes by clicking placeholder elements, and nodes position automatically.

See example
[object Object] screenshot

LAYOUT

Node Collisions

Automatically resolve node overlaps using collision detection algorithms

See example

Styling

[object Object] screenshot

STYLING

Base Style

Show the bare-bones base style that is built into React Flow, but is not used by default

See example
[object Object] screenshot

STYLING

Dark Mode

React Flow comes with a color mode prop that allows you to switch between dark, light and system mode.

See example
[object Object] screenshot

STYLING

Tailwind

Use Tailwind CDN to easily make nice looking flows

See example
[object Object] screenshot

STYLING

Turbo Flow

Nodes with glowing animated gradient borders, inspired by the turbo.build website

See example

Whiteboard

[object Object] screenshot

WHITEBOARD

Eraser Tool

A tool that let's you delete nodes and edges by wiping

See example
[object Object] screenshot

WHITEBOARD

Lasso Selection

An example about selecting multiple items using a lasso selection tool.

See example
[object Object] screenshot

WHITEBOARD

Rectangle

An example about drawing rectangles on a whiteboard using Svelte Flow.

See example
[object Object] screenshot

WHITEBOARD

Freehand DrawPro

An example of freehand drawing

See example

Misc

[object Object] screenshot

MISC

Download Image

Save a flow as a png with the html-to-image library

See example
[object Object] screenshot

MISC

Server Side Image CreationPro

Generate static images of React Flow graphs on the server with Puppeteer

See example
Last updated on