Edge
Where a Connection is the minimal description of an edge between
two nodes, an Edge is the complete description with everything React Flow needs
to know in order to render it.
export type Edge<T> = DefaultEdge<T> | SmoothStepEdge<T> | BezierEdge<T>;Variants
Edge
| Name | Type | Default |
|---|---|---|
id | stringUnique id of an edge. | |
type | EdgeTypeType of edge defined in | |
source | stringId of source node. | |
target | stringId of target node. | |
sourceHandle | string | nullId of source handle, only needed if there are multiple handles per node. | |
targetHandle | string | nullId of target handle, only needed if there are multiple handles per node. | |
animated | boolean | |
deletable | boolean | |
selectable | boolean | |
data | EdgeDataArbitrary data passed to an edge. | |
selected | boolean | |
markerStart | EdgeMarkerTypeSet the marker on the beginning of an edge. | |
markerEnd | EdgeMarkerTypeSet the marker on the end of an edge. | |
zIndex | number | |
ariaLabel | string | |
interactionWidth | numberReactFlow renders an invisible path around each edge to make them easier to click or tap on. This property sets the width of that invisible path. | |
label | ReactNodeThe label or custom element to render along the edge. This is commonly a text label or some custom controls. | |
labelStyle | CSSPropertiesCustom styles to apply to the label. | |
labelShowBg | boolean | |
labelBgStyle | CSSProperties | |
labelBgPadding | [number, number] | |
labelBgBorderRadius | number | |
style | CSSProperties | |
className | string | |
reconnectable | boolean | HandleTypeDetermines whether the edge can be updated by dragging the source or target to a new node.
This property will override the default set by the | |
focusable | boolean | |
ariaRole | AriaRoleThe ARIA role attribute for the edge, used for accessibility. | "group" |
domAttributes | Omit<SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">General escape hatch for adding custom attributes to the edge’s DOM element. |
SmoothStepEdge
The SmoothStepEdge variant has all the same fields as an Edge, but it also has the following additional fields:
| Name | Type | Default |
|---|---|---|
type | "smoothstep" | |
pathOptions | { offset?: number; borderRadius?: number; } |
BezierEdge
The BezierEdge variant has all the same fields as an Edge, but it also has the following additional fields:
| Name | Type | Default |
|---|---|---|
type | "default" | |
pathOptions | { curvature?: number; } |
Default edge types
You can create any of React Flow’s default edges by setting the type property
to one of the following values:
"default""straight""step""smoothstep""simplebezier"
If you don’t set the type property at all, React Flow will fallback to the
"default" bezier curve edge type.
These default edges are available even if you set the edgeTypes
prop to something else, unless you override any of these keys directly.