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
NODES
This is an example of a custom node implementation. Svelte Flow nodes are Svelte components, and you can display any content that you want.
NODES
This example shows how to update the data field of a specific node.
NODES
A stress test with a lot of nodes and edges.
NODES
NODES
NODES
Example showing how to automatically create edges when nodes get close to each other
NODES
This is an example of a custom node limiting the amount of connections a handle can have using the `isConnectalbe` prop.
NODES
NODES
NODES
Edges
EDGES
EDGES
Svelte Flow has four edge types- bezier, straight, step and smoothstep. It’s also possible to create a custom edge, if you need a special edge routing or controls at the edge.
EDGES
The EdgeLabelRenderer component can be used to render labels
EDGES
Example for demonstrating edge markers in Svelte Flow.
EDGES
example showing different kinds of edge types in svelte flow
EDGES
Layout
LAYOUT
You can integrate dagre.js with Svelte Flow to create tree layouts. A good alternative to dagre is elkjs if you are looking for a more advanced layouting library.
LAYOUT
If you're looking for a more powerful alternative to dagre, you can also use elkjs to layout your Svelte Flow graphs.
LAYOUT
LAYOUT
You can create nested flows - known as subflows - with Svelte Flow. Here you can see how to implement them.
Interaction
INTERACTION
This example combines some hooks and helper functions for computing the data flow between nodes.
INTERACTION
INTERACTION
INTERACTION
This example shows how to implement a sidebar with a drag and drop functionality.
INTERACTION
This example explains how to validte new connections between nodes.
Styling
STYLING
Svelte Flow comes with a default style and a base style. This example shows how the base style looks.
STYLING
Svelte Flow comes with a default style and a base style. This example shows how the base style looks.
STYLING
In this example we demonstrate how to use tailwind for styling a flow.
STYLING
This example showcases how you can recreate the style that is used in the turbo docs.
Misc
MISC
MISC
This example shows how you can use Svelte Flow in combination with Threlte to create a flow that controls a 3D scene.
MISC
The useSvelteFlow hook gives you access to the Svelte Flow store and provides some functions for updating the viewport.