Reference
Node

Node<T, U>

Deprecation of parentNode property! We have renamed the parentNode option to parentId in version 11.11.0. The old property is still supported but will be removed in version 12.

Source on GitHub (opens in a new tab)

The Node type represents everything React Flow needs to know about a given node. Many of these properties can be manipulated both by React Flow or by you, but some such as width and height should be considered read-only.

export type Node<T, U extends string> = {
  id: string;
  position: XYPosition;
  data: T;
  type?: U;
  sourcePosition?: Position;
  targetPosition?: Position;
  hidden?: boolean;
  selected?: boolean;
  dragging?: boolean;
  draggable?: boolean;
  selectable?: boolean;
  connectable?: boolean;
  resizing?: boolean;
  deletable?: boolean;
  dragHandle?: string;
  width?: number | null;
  height?: number | null;
  /** @deprecated - use `parentId` instead */
  parentNode?: string;
  parentId?: string;
  zIndex?: number;
  extent?: 'parent' | CoordinateExtent;
  expandParent?: boolean;
  positionAbsolute?: XYPosition;
  ariaLabel?: string;
  focusable?: boolean;
  style?: React.CSSProperties;
  className?: string;
};

Fields

#id
string
#position
#data
T
#type?
U
#sourcePosition?
#targetPosition?
#hidden?
boolean
#selected?
boolean
#dragging?
boolean
#draggable?
boolean
#selectable?
boolean
#connectable?
boolean
#resizing?
boolean
#deletable?
boolean
#dragHandle?
string
#width?
number | null
#height?
number | null
#parentNode?
string
#parentId?
string
#zIndex?
number
#extent?
"parent" | CoordinateExtent
#expandParent?
boolean
#positionAbsolute?
#ariaLabel?
string
#focusable?
boolean
#style?
#className?
string

Default node types

You can create any of React Flow's default nodes by setting the type property to one of the following values:

  • "default"
  • "input"
  • "output"
  • "group"

If you don't set the type property at all, React Flow will fallback to the "default" node with both an input and output port.

These default nodes are available even if you set the nodeTypes prop to something else, unless you override any of these keys directly.

Notes

  • You shouldn't try to set the width or height of a node directly. It is calculated internally by React Flow and used when rendering the node in the viewport. To control a node's size you should use the style or className props to apply CSS styles instead.