Expert guidance for React Flow (@xyflow/react): building interactive node-based graphs, custom nodes and edges, handles, state management, layouting, TypeScript patterns, performance optimization, and theming. Use when writing React Flow code, creating custom nodes or edges, debugging flow issues, optimizing graph performance, integrating with Zustand, or building canvas-based UIs with React Flow.
Use this skill to build, customize, debug, and optimize interactive node-based UIs with React Flow (@xyflow/react v12+). Covers everything from basic setup to advanced patterns like computed flows, sub-flows, and external layout integration.
@xyflow/react — never from legacy reactflow or react-flow-renderer packages.import '@xyflow/react/dist/style.css' (or base.css for custom styling frameworks).<ReactFlow> parent container must have explicit width and height — this is the #1 cause of blank canvases.nodeTypes and edgeTypes objects outside component bodies or wrap in useMemo to prevent re-renders.nodrag class on interactive elements inside custom nodes (inputs, buttons, selects).nowheel class on scrollable elements inside custom nodes to prevent zoom interference.visibility: hidden or opacity: 0 — never display: none (breaks dimension calculation).id props.useUpdateNodeInternals to refresh the node.onNodesChange/onEdgesChange/onConnect) for any non-trivial application.@xyflow/react)display: none on handlesonConnect handler or handle configurationreferences/fundamentals.mdreferences/custom-nodes.mdreferences/custom-edges.mdreferences/interactivity.mdreferences/state-management.mdreferences/typescript.mdreferences/layouting.mdreferences/components-and-hooks.mdreferences/performance-and-styling.mdreferences/troubleshooting.mdreferences/e2e-testing.mdreferences/advanced-patterns.mdheight: 100vh or equivalent.nodeTypes / edgeTypes warning -> move object definition outside component body or wrap in useMemo.display: none; switch to opacity: 0.className="nodrag" to interactive elements.onNodesChange not wired up or not applying changes correctly.onConnect handler missing or not calling addEdge.top offset) and assign unique ids.@xyflow/react installed or missing <ReactFlowProvider>.nodes array.@xyflow/react/dist/style.css is imported (or base.css + custom styles).nodeTypes / edgeTypes are stable references (defined outside component or memoized).<Handle> components with proper type and position.nodrag class.onNodesChange, onEdgesChange, onConnect.React.memo.references/fundamentals.mdreferences/custom-nodes.mdreferences/custom-edges.mdreferences/interactivity.mdreferences/state-management.mdreferences/typescript.mdreferences/layouting.mdreferences/components-and-hooks.mdreferences/performance-and-styling.mdreferences/troubleshooting.mdreferences/e2e-testing.mdreferences/advanced-patterns.md