Utils
addEdge()
This util is a convenience function to add a new Edge to an array of edges. It also performs some validation to make sure you don't add an invalid edge or duplicate an existing one.
Read moreapplyEdgeChanges()
Various events on the ReactFlow component can produce an EdgeChange that describes how to update the edges of your flow in some way. If you don't need any custom behaviour, this util can be used to take an array of these changes and apply them to your edges.
Read moreapplyNodeChanges()
Various events on the ReactFlow component can produce an NodeChange that describes how to update the edges of your flow in some way. If you don't need any custom behaviour, this util can be used to take an array of these changes and apply them to your edges.
Read moregetBezierPath()
The getBezierPath util returns everything you need to render a bezier edge between two nodes.
Read moregetConnectedEdges()
Given an array of nodes that may be connected to one another and an array of all your edges, this util gives you an array of edges that connect any of the given nodes together.
Read moregetIncomers()
This util is used to tell you what nodes, if any, are connected to the given node as the source of an edge.
Read moregetMarkerEnd()
Helper that returns internal marker id or user defined marker id.
Read moregetNodesBounds()
Returns the bounding box that contains all the given nodes in an array. This can be useful when combined with getTransformForBounds to calculate the correct transform to fit the given nodes in a viewport.
Read moregetOutgoers()
This util is used to tell you what nodes, if any, are connected to the given node as a the target of an edge.
Read moregetRectOfNodes()
Returns the bounding box that contains all the given nodes in an array. This can be useful when combined with getTransformForBounds to calculate the correct transform to fit the given nodes in a viewport.
Read moregetSimpleBezierPath()
The getSimpleBezierPath util returns everything you need to render a simple bezier edge between two nodes.
Read moregetSmoothStepPath()
The getSmoothStepPath util returns everything you need to render a stepped path between two nodes. The borderRadius property can be used to choose how rounded the corners of those steps are.
Read moregetStraightPath()
Calculates the straight line path between two points.
Read moregetTransformForBounds()
This util tells you what to set the viewport to in order to fit the given bounds. You might use this to pre-calculate the viewport for a given set of nodes on the server or calculate the viewport for the given bounds _without_ changing the viewport directly.
Read moregetViewportForBounds()
This util returns the viewport for the given bounds. You might use this to pre-calculate the viewport for a given set of nodes on the server or calculate the viewport for the given bounds _without_ changing the viewport directly.
Read moreisEdge()
Test whether an object is useable as an Edge. In TypeScript this is a type guard that will narrow the type of whatever you pass in to Edge if it returns true.
Read moreisNode()
Test whether an object is useable as an Node. In TypeScript this is a type guard that will narrow the type of whatever you pass in to Node if it returns true.
Read moreupdateEdge()
A handy utility to update an existing Edge with new properties. This searches your edge array for an edge with a matching id and updates its properties with the connection you provide.
Read more