Skip to Content
React Flow 13 is here! Read the announcement →
ReferenceTypes

NodeChange

Source on GitHub 

The onNodesChange callback takes an array of NodeChange objects that you should use to update your flow’s state. The NodeChange type is a union of six different object types that represent that various ways an node can change in a flow.

export type NodeChange = | DimensionChange | PositionChange | SelectionChange | RemoveChange | AddChange | ReplaceChange;

Variant types

DimensionChange

NameTypeDefault
idstring
type"dimensions"
dimensionsDimensions
resizingboolean
setAttributesboolean | "width" | "height"

PositionChange

NameTypeDefault
idstring
type"position"
positionXYPosition
positionAbsoluteXYPosition
draggingboolean

SelectionChange

NameTypeDefault
idstring
type"select"
selectedboolean

RemoveChange

NameTypeDefault
idstring
type"remove"

AddChange

NameTypeDefault
idstring
itemNodeOrEdge
type"add"
indexnumber

ReplaceChange

NameTypeDefault
idstring
itemNodeOrEdge
type"replace"