llms.txt
Compare with other sites' llms.txt files →# React Flow documentation
> React Flow is a library for building interactive, node-based user interfaces such as flowcharts, diagrams, visual programming tools, and workflows. It supports theming, custom nodes and edges, and a library of shadcn UI components.
## Guides
- [Quick Start](https://reactflow.dev/learn): React Flow quickstart that shows how to install the package, use it and where to find example apps
- Core Concepts
- [Overview](https://reactflow.dev/learn/concepts/terms-and-definitions): Learn about the basic terms and definitions of React Flow
- [Building a Flow](https://reactflow.dev/learn/concepts/building-a-flow): A step-by-step guide to creating your first flow diagram with React Flow. Learn how to set up the canvas, add nodes and edges, and enhance your flow with built-in features like viewport fitting and custom node types.
- [Adding Interactivity](https://reactflow.dev/learn/concepts/adding-interactivity): This guide will show you how to add basic interactivity to your flow.
- [The Viewport](https://reactflow.dev/learn/concepts/the-viewport): Learn how to customize the panning and zooming behavior of React Flow.
- [Built-In Components](https://reactflow.dev/learn/concepts/built-in-components): React Flow comes with several built-in components. Here's an overview of the minimap, controls, background, and panel components.
- Customization
- [Nodes](https://reactflow.dev/learn/customization/custom-nodes): Custom nodes in React Flow are just React components. This guide shows you how to implement your own nodes.
- [Handles](https://reactflow.dev/learn/customization/handles): This guide shows you how to add handles to custom nodes in React Flow.
- [Edges](https://reactflow.dev/learn/customization/custom-edges): Like custom nodes, parts of a custom edge in React Flow are just React components. This guide shows you how to implement a custom edge with some additional controls.
- [Edge Labels](https://reactflow.dev/learn/customization/edge-labels): This guide shows you how to render custom edge labels onto custom edges in React Flow.
- [Utility Classes](https://reactflow.dev/learn/customization/utility-classes): This guide gives you an overview of utility classes in React Flow that help you control interactions within custom nodes.
- [Theming](https://reactflow.dev/learn/customization/theming): React Flow comes with a minimal default theme. It's common to overwrite the default styles with your own CSS or use third-party libraries like TailwindCSS.
- Layouting
- [Overview](https://reactflow.dev/learn/layouting/layouting): React Flow doesn't include any layouting algorithms out of the box. This guide surveys some of the options out there and shows you how to use them with React Flow.
- [Sub Flows](https://reactflow.dev/learn/layouting/sub-flows): Learn how to use sub flows to group nodes together in a flow.
- Advanced Use
- [Hooks and Providers](https://reactflow.dev/learn/advanced-use/hooks-providers): Overview of Hooks and Providers in React Flow.
- [Accessibility](https://reactflow.dev/learn/advanced-use/accessibility): React Flow is designed to be both keyboard and screen reader accessible.
- [Testing](https://reactflow.dev/learn/advanced-use/testing): How to test React Flow applications with Cypress, Playwright or Jest.
- [TypeScript](https://reactflow.dev/learn/advanced-use/typescript): In this guide we explain how to work with React Flow and TypeScript.
- [Uncontrolled Flow](https://reactflow.dev/learn/advanced-use/uncontrolled-flow): Uncontrolled inputs in React manage their own state internally. This guide shows you how to set up and use an uncontrolled flow.
- [Performance](https://reactflow.dev/learn/advanced-use/performance): Strategies to optimize React Flow performance for large graphs.
- [State Management](https://reactflow.dev/learn/advanced-use/state-management): Learn how to use React Flow with a state management library like Zustand, Redux, Recoil or Jotai.
- [Computing Flows](https://reactflow.dev/learn/advanced-use/computing-flows): Learn how to extend React Flow to compute data going through flow graphs.
- [Server Side Rendering](https://reactflow.dev/learn/advanced-use/ssr-ssg-configuration): Step-by-step guide render React Flow apps on the server for displaying static flows, dynamically generating images from flows, or rendering graphs in non-javascript environments
- [Devtools](https://reactflow.dev/learn/advanced-use/devtools-and-debugging): Copy pastable devtools for React Flow
- [Multiplayer](https://reactflow.dev/learn/advanced-use/multiplayer): Learn how to use React Flow with realtime multiplayer collaboration features.
- [Whiteboard Features](https://reactflow.dev/learn/advanced-use/whiteboard): Learn how to add drawing capabilities to your React Flow applications, including freehand drawing, rectangle shapes, lasso selection, and erasing.
- Tutorials
- [Slideshow App](https://reactflow.dev/learn/tutorials/slide-shows-with-react-flow)
- [Web Audio API](https://reactflow.dev/learn/tutorials/react-flow-and-the-web-audio-api)
- [Mind Map App](https://reactflow.dev/learn/tutorials/mind-map-app-with-react-flow)
- [React Flow UI](https://reactflow.dev/learn/tutorials/getting-started-with-react-flow-components)
- Troubleshooting
- [Common Errors](https://reactflow.dev/learn/troubleshooting/common-errors): Troubleshooting and fixes for common issues with React Flow.
- [Migrate to v12](https://reactflow.dev/learn/troubleshooting/migrate-to-v12): Use this guide to migrate from React Flow 11 to 12.
- [Migrate to v11](https://reactflow.dev/learn/troubleshooting/migrate-to-v11): Use this guide to migrate from React Flow v10 to v11.
- [Migrate to v10](https://reactflow.dev/learn/troubleshooting/migrate-to-v10): Use this guide to migrate from React Flow v9 to v10.
## Examples
- [All Examples](https://reactflow.dev/examples): Overview of React Flow examples for practical copy-paste solutions to common use cases.
- [Pro Examples](https://reactflow.dev/examples/pro-examples): Advanced React Flow code examples to use in your node-based UIs, crafted by the React Flow core team.
- [Feature Overview](https://reactflow.dev/examples/overview): The most used features of React Flow - controls, MiniMap, node types, edge types, edge labels, and custom styling.
- Nodes
- [Add Node On Edge Drop](https://reactflow.dev/examples/nodes/add-node-on-edge-drop): A new node appears wherever you drop the connection line
- [Connection Limit](https://reactflow.dev/examples/nodes/connection-limit): Use the `isConnectable` prop to limit the number of connections a handle can have
- [Custom Nodes](https://reactflow.dev/examples/nodes/custom-node): Display any content inside of a node
- [Delete Middle Node](https://reactflow.dev/examples/nodes/delete-middle-node): Remove a node without breaking the flow
- [Drag Handle](https://reactflow.dev/examples/nodes/drag-handle): Restrict dragging to a specific part of node
- [Easy Connect](https://reactflow.dev/examples/nodes/easy-connect): Make the whole node into a handle
- [Intersections](https://reactflow.dev/examples/nodes/intersections): Detect when a node overlaps with another node
- [Node Resizer](https://reactflow.dev/examples/nodes/node-resizer): Change the size of a node with a bounding box or draggable icon
- [Node Toolbar](https://reactflow.dev/examples/nodes/node-toolbar): A toolbar with buttons appears next to the selected node
- [Proximity Connect](https://reactflow.dev/examples/nodes/proximity-connect): Automatically create edges when nodes get close to each other
- [Rotatable Node](https://reactflow.dev/examples/nodes/rotatable-node): A custom node that can be rotated using CSS transforms
- [Node Position Animation](https://reactflow.dev/examples/nodes/node-position-animation): Animate smooth transitions between different graph layouts with interactive controls
- [Stress Test](https://reactflow.dev/examples/nodes/stress): Render hundreds of nodes and edges at once
- [Updating Nodes](https://reactflow.dev/examples/nodes/update-node): Update the data field of a specific node
- [Shapes](https://reactflow.dev/examples/nodes/shapes): Render Custom Nodes with different shapes that are commonly used in flow charts
- Edges
- [Animating Edges](https://reactflow.dev/examples/edges/animating-edges): Create edge animations that go beyond the built-in animated edge.
- [Custom Connection Line](https://reactflow.dev/examples/edges/custom-connectionline): Change the appearance and behavior of the connection line
- [Custom Edges](https://reactflow.dev/examples/edges/custom-edges): Create edges with special routing or controls along the edge
- [Delete Edge on Drop](https://reactflow.dev/examples/edges/delete-edge-on-drop): Delete an edge when it doesn't find a handle
- [Edge Label Renderer](https://reactflow.dev/examples/edges/edge-label-renderer): Render edge labels as divs on top of edges
- [Edge Intersection](https://reactflow.dev/examples/edges/edge-intersection): Detect edge intersections with nodes while dragging.
- [Edge Toolbar](https://reactflow.dev/examples/edges/edge-toolbar): You can use the EdgeToolbar component to display content on top of an edge.
- [Edge Types](https://reactflow.dev/examples/edges/edge-types): Make edges straight, stepped, smooth-stepped, or bezier curved
- [Edge Routing](https://reactflow.dev/examples/edges/edge-routing): Implement a routable edge with libavoid
- [Floating Edges](https://reactflow.dev/examples/edges/floating-edges): Instead of having the handle at a fixed point, let it move with the connected edge
- [Edge Markers](https://reactflow.dev/examples/edges/markers): Make your edges into arrows, add custom icons, or SVGs
- [Multi Connection Line](https://reactflow.dev/examples/edges/multi-connection-line): Draw multiple connection lines at once from any selected nodes.
- [Reconnect Edge](https://reactflow.dev/examples/edges/reconnect-edge): Click-drag to move an existing edge from one handle to another
- [Simple Floating Edges](https://reactflow.dev/examples/edges/simple-floating-edges): Edges connect to the closest available handle
- [Temporary Edges](https://reactflow.dev/examples/edges/temporary-edges): Push what React Flow edges are capable of by rendering invisible ghost nodes.
- [Editable Edge](https://reactflow.dev/examples/edges/editable-edge): Implement a custom edge with draggable control points to change the path of an edge
- Interaction
- [Computing Flows](https://reactflow.dev/examples/interaction/computing-flows): This examples demonstrates how to use the helpers to handle data flow
- [Connection Events](https://reactflow.dev/examples/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.
- [Context Menu](https://reactflow.dev/examples/interaction/context-menu): Right-click a node to display custom actions
- [Contextual Zoom](https://reactflow.dev/examples/interaction/contextual-zoom): Only display the content of a node when you are zoomed in close enough
- [Drag and Drop](https://reactflow.dev/examples/interaction/drag-and-drop): Drag and drop outside of the React Flow pane with native HTML Drag and Drop API or react-draggable.
- [Preventing Cycles](https://reactflow.dev/examples/interaction/prevent-cycles): Check if a new connection would cause a cycle in the graph
- [Save and Restore](https://reactflow.dev/examples/interaction/save-and-restore): Save the state of the diagram, and reload it after refreshing the page
- [Touch Device](https://reactflow.dev/examples/interaction/touch-device): Tap two handles to connect them, and make handles bigger for smaller devices
- [Validation](https://reactflow.dev/examples/interaction/validation): Check if a new connection is valid and should be added
- [Helper Lines](https://reactflow.dev/examples/interaction/helper-lines): Display lines that help to visually align nodes, with automatic snapping for precise positioning and layout control.
- [Collaborative](https://reactflow.dev/examples/interaction/collaborative): Build a collaborative graph for multiple users with React Flow and yjs
- [Copy and Paste](https://reactflow.dev/examples/interaction/copy-paste): Select nodes and edges to cut, copy, and paste
- [Undo and Redo](https://reactflow.dev/examples/interaction/undo-redo): Undo and redo functionality for moving, adding, and deleting nodes and edges
- Subflows & Grouping
- [Selection Grouping](https://reactflow.dev/examples/grouping/selection-grouping): This example demonstrates how to create dynamic node grouping in React Flow.
- [Parent Child Relation](https://reactflow.dev/examples/grouping/parent-child-relation): Dynamically attach and detach nodes from parent containers with drag and drop functionality
- [Sub Flow](https://reactflow.dev/examples/grouping/sub-flows): Render nested graphs and group nodes, and configure the behavior of child nodes
- Layout
- [Dagre Tree](https://reactflow.dev/examples/layout/dagre): Integrate dagre js with React Flow to create simple tree layouts
- [Elkjs Tree](https://reactflow.dev/examples/layout/elkjs): For a more powerful alternative to dagre, you can also use elkjs to layout your graphs
- [Elkjs Multiple Handles](https://reactflow.dev/examples/layout/elkjs-multiple-handles): Use multiple handles with the elkjs layouting engine to reduce edge crossings
- [Horizontal Flow](https://reactflow.dev/examples/layout/horizontal): A diagram that flows from left to right
- [Expand and Collapse](https://reactflow.dev/examples/layout/expand-collapse): Create hierarchical trees with expandable and collapsible nodes using dagre for automatic layouts
- [Auto Layout](https://reactflow.dev/examples/layout/auto-layout): Automatically arrange nodes using various layout engines like dagre, d3-hierarchy, or elkjs
- [Force Layout](https://reactflow.dev/examples/layout/force-layout): Newly added nodes never overlap with existing nodes using d3-force
- [Dynamic Layouting](https://reactflow.dev/examples/layout/dynamic-layouting): A self-organizing graph where users add nodes by clicking placeholder elements, and nodes position automatically.
- [Node Collisions](https://reactflow.dev/examples/layout/node-collisions): Automatically resolve node overlaps using collision detection algorithms
- Styling
- [Base Style](https://reactflow.dev/examples/styling/base-style): Show the bare-bones base style that is built into React Flow, but is not used by default
- [Dark Mode](https://reactflow.dev/examples/styling/dark-mode): React Flow comes with a color mode prop that allows you to switch between dark, light and system mode.
- [Tailwind](https://reactflow.dev/examples/styling/tailwind): Use Tailwind CDN to easily make nice looking flows
- [Turbo Flow](https://reactflow.dev/examples/styling/turbo-flow): Nodes with glowing animated gradient borders, inspired by the turbo.build website
- Whiteboard
- [Eraser Tool](https://reactflow.dev/examples/whiteboard/eraser): A tool that let's you delete nodes and edges by wiping
- [Lasso Selection](https://reactflow.dev/examples/whiteboard/lasso-selection): An example about selecting multiple items using a lasso selection tool.
- [Rectangle](https://reactflow.dev/examples/whiteboard/rectangle): An example about drawing rectangles on a whiteboard using React Flow.
- [Freehand Draw](https://reactflow.dev/examples/whiteboard/freehand-draw): Freehand drawing on the canvas.
- Misc
- [Download Image](https://reactflow.dev/examples/misc/download-image): Save a flow as a png with the html-to-image library
- [Server Side Image Creation](https://reactflow.dev/examples/misc/server-side-image-creation): Generate static images of React Flow graphs on the server with Puppeteer
## API reference
- [API Reference](https://reactflow.dev/api-reference)
- [<ReactFlow />](https://reactflow.dev/api-reference/react-flow)
- [<ReactFlowProvider />](https://reactflow.dev/api-reference/react-flow-provider)
- [Components](https://reactflow.dev/api-reference/components)
- [<Background />](https://reactflow.dev/api-reference/components/background): The Background component makes it convenient to render different types of backgrounds common in node-based UIs. It comes with three variants: lines, dots and cross.
- [<BaseEdge />](https://reactflow.dev/api-reference/components/base-edge): The BaseEdge component gets used internally for all the edges. It can be used inside a custom edge and handles the invisible helper edge and the edge label for you.
- [<ControlButton />](https://reactflow.dev/api-reference/components/control-button): You can add buttons to the control panel by using the ControlButton component and pass it as a child to the Controls component.
- [<Controls />](https://reactflow.dev/api-reference/components/controls): The Controls component renders a small panel that contains convenient buttons to zoom in, zoom out, fit the view, and lock the viewport.
- [<EdgeLabelRenderer />](https://reactflow.dev/api-reference/components/edge-label-renderer): Edges are SVG-based. If you want to render more complex labels you can use the EdgeLabelRenderer component to access a div based renderer. This component is a portal that renders the label in a div that is positioned on top of the edges. You can see an example usage of the component in the edge label renderer example.
- [<EdgeText />](https://reactflow.dev/api-reference/components/edge-text): You can use the EdgeText component as a helper component to display text within your custom edges.
- [<EdgeToolbar />](https://reactflow.dev/api-reference/components/edge-toolbar): The EdgeToolbar component can render a toolbar or tooltip to one side of a custom edge. This toolbar doesn't scale with the viewport so that the content doesn't get too small when zooming out.
- [<Handle />](https://reactflow.dev/api-reference/components/handle): The Handle component is used in your custom nodes to define connection points.
- [<MiniMap />](https://reactflow.dev/api-reference/components/minimap): The MiniMap component can be used to render an overview of your flow. It renders each node as an SVG element and visualizes where the current viewport is in relation to the rest of the flow.
- [<NodeResizeControl />](https://reactflow.dev/api-reference/components/node-resize-control): To create your own resizing UI, you can use the NodeResizeControl component where you can pass children (such as icons).
- [<NodeResizer />](https://reactflow.dev/api-reference/components/node-resizer): The NodeResizer component can be used to add a resize functionality to your nodes. It renders draggable controls around the node to resize in all directions.
- [<NodeToolbar />](https://reactflow.dev/api-reference/components/node-toolbar): The NodeToolbar component can render a toolbar or tooltip to one side of a custom node. This toolbar doesn't scale with the viewport so that the content is always visible.
- [<Panel />](https://reactflow.dev/api-reference/components/panel): The Panel component helps you position content above the viewport. It is used internally by the MiniMap and Controls components.
- [<ViewportPortal />](https://reactflow.dev/api-reference/components/viewport-portal): The ViewportPortal component can be used to add components to the same viewport of the flow where nodes and edges are rendered. This is useful when you want to render your own components that are adhere to the same coordinate system as the nodes & edges and are also affected by zooming and panning
- [Hooks](https://reactflow.dev/api-reference/hooks)
- [useConnection()](https://reactflow.dev/api-reference/hooks/use-connection): The useConnection hook returns the current connection when there is an active connection inte