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%2Fcustom-node%2Fpreview.jpg&w=3840&q=75)
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.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fupdate-node%2Fpreview.jpg&w=3840&q=75)
NODES
This example shows how to update the data field of a specific node.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fstress%2Fpreview.jpg&w=3840&q=75)
NODES
A stress test with a lot of nodes and edges.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fdrag-handle%2Fpreview.jpg&w=3840&q=75)
NODES
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fadd-node-on-edge-drop%2Fpreview.jpg&w=3840&q=75)
NODES
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fproximity-connect%2Fpreview.jpg&w=3840&q=75)
NODES
Example showing how to 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%2Fconnection-limit%2Fpreview.jpg&w=3840&q=75)
NODES
This is an example of a custom node limiting the amount of connections a handle can have using the `isConnectalbe` prop.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Feasy-connect%2Fpreview.jpg&w=3840&q=75)
NODES
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fintersections%2Fpreview.jpg&w=3840&q=75)
NODES
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fnodes%2Fnode-resizer%2Fpreview.jpg&w=3840&q=75)
NODES
Edges
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Fcustom-connectionline%2Fpreview.jpg&w=3840&q=75)
EDGES
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Fcustom-edges%2Fpreview.jpg&w=3840&q=75)
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.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Fedge-label-renderer%2Fpreview.jpg&w=3840&q=75)
EDGES
The EdgeLabelRenderer component can be used to render labels
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Fedge-markers%2Fpreview.jpg&w=3840&q=75)
EDGES
Example for demonstrating edge markers in Svelte Flow.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Fedge-types%2Fpreview.jpg&w=3840&q=75)
EDGES
example showing different kinds of edge types in svelte flow
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fedges%2Fsimple-floating-edges%2Fpreview.jpg&w=3840&q=75)
EDGES
Layout
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Flayout%2Fdagre%2Fpreview.jpg&w=3840&q=75)
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.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Flayout%2Felkjs%2Fpreview.jpg&w=3840&q=75)
LAYOUT
If you're looking for a more powerful alternative to dagre, you can also use elkjs to layout your Svelte Flow graphs.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Flayout%2Fhorizontal-flow%2Fpreview.jpg&w=3840&q=75)
LAYOUT
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Flayout%2Fsubflows%2Fpreview.jpg&w=3840&q=75)
LAYOUT
You can create nested flows - known as subflows - with Svelte Flow. Here you can see how to implement them.
Interaction
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Finteraction%2Fcomputing-flows%2Fpreview.jpg&w=3840&q=75)
INTERACTION
This example combines some hooks and helper functions for computing the data flow between nodes.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Finteraction%2Fcontext-menu%2Fpreview.jpg&w=3840&q=75)
INTERACTION
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Finteraction%2Fcontextual-zoom%2Fpreview.jpg&w=3840&q=75)
INTERACTION
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Finteraction%2Fdrag-and-drop%2Fpreview.jpg&w=3840&q=75)
INTERACTION
This example shows how to implement a sidebar with a drag and drop functionality.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Finteraction%2Fvalidation%2Fpreview.jpg&w=3840&q=75)
INTERACTION
This example explains how to validte new connections between nodes.
Styling
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fstyling%2Fbase-style%2Fpreview.jpg&w=3840&q=75)
STYLING
Svelte Flow comes with a default style and a base style. This example shows how the base style looks.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fstyling%2Fdark-mode%2Fpreview.jpg&w=3840&q=75)
STYLING
Svelte Flow comes with a default style and a base style. This example shows how the base style looks.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fstyling%2Ftailwind%2Fpreview.jpg&w=3840&q=75)
STYLING
In this example we demonstrate how to use tailwind for styling a flow.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fstyling%2Fturbo-flow%2Fpreview.jpg&w=3840&q=75)
STYLING
This example showcases how you can recreate the style that is used in the turbo docs.
Misc
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fmisc%2Fdownload-image%2Fpreview.jpg&w=3840&q=75)
MISC
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fmisc%2Fthrelte-flow%2Fpreview.jpg&w=3840&q=75)
MISC
This example shows how you can use Svelte Flow in combination with Threlte to create a flow that controls a 3D scene.
![[object Object] screenshot](/_next/image?url=https%3A%2F%2Fexample-apps.xyflow.com%2Fsvelte%2Fexamples%2Fmisc%2Fuse-svelte-flow%2Fpreview.jpg&w=3840&q=75)
MISC
The useSvelteFlow hook gives you access to the Svelte Flow store and provides some functions for updating the viewport.