Connector API

React Connector props, rules and defaults, surfaces, and ref.

Connector must render inside a Node (it throws otherwise). It owns (or adopts) a core ConnectorMirror registered against the parent node. The forwarded ref is a ConnectorRef whose object() returns the mirror.

PropMeaning
idStable domain identity; minted when omitted — supply it for persistence
nameRequired. The connector’s key within its parent node
rulesPartial<ConnectorRules> admission rules (see below)
metadataSnapLineMetadata attached to the connector
callbacksConnectorCallbacks (pointer, candidate, connection events)
surfaceStrategiesCustom source/target hit-test and anchor strategies
virtualKeep the logical connector without rendering a port element; surfaces resolve against the parent node
colliderRadiusPointer pickup radius override
edgePanPan the camera when dragging a line near the viewport edge (default true)
connectorObjectAdopt an existing ConnectorMirror
className, stylePresentation for the port element
dataExtra data-* attributes for the port element

name and connectorObject are construction-time identities; every other prop updates across renders, including virtual.

Connection rules

RuleDefaultMeaning
maxOutgoing"unlimited"Maximum outgoing lines (previews reserve a slot); 0 makes the connector target-only
maxIncoming1Maximum settled incoming lines; 0 makes the connector source-only
reconnecttrueAllow dragging a settled line’s end to a new target
allowParallelfalseBoth endpoints must allow parallel lines between the same pair
onFull"reject"Policy when a proposal would exceed maxIncoming: "reject" it, or "replace-oldest" to evict the oldest incoming lines
isValidConnectionLine-aware admission predicate; synchronous and side-effect free, called repeatedly during candidate discovery and rechecked on drop. Either endpoint may veto

An omitted rules prop therefore yields an unlimited-outgoing, single-incoming connector that rejects extra incoming lines.

Warning

Topology methods on ConnectorMirror such as createLine, deleteLine, deleteAllLines, and disconnectFromConnector are @internal. Change topology by updating your canonical LineRecords through ControlledGraph.