Node API
React Node props, callbacks, resize configuration, ref, and hooks.
Node renders a draggable node element and owns (or adopts) a core NodeMirror. The forwarded ref is the NodeMirror.
| Prop | Meaning |
|---|---|
id | Stable domain identity; minted when omitted — supply it for persistence |
nodeObject | Adopt an existing NodeMirror instead of creating one |
x, y, width, height | World geometry; changed props resynchronize the object |
resizable | Enable resize handles (default false) |
minWidth, minHeight | Resize floor |
resizeHandles | true for all handles, or a subset of "n" \| "ne" \| "e" \| "se" \| "s" \| "sw" \| "w" \| "nw" |
resizeHandleThickness | Handle hit area in pixels (default 14) |
resizeCursors | Per-handle cursor overrides |
metadata | SnapLineMetadata attached to the node |
callbacks | NodeCallbacks object (drag, selection, resize, lines) |
onGeometryChanged | Convenience callback; batched final geometry for persistence |
onSizeChange | Convenience callback for resize events |
edgePan | Pan the camera when dragging near the viewport edge (default true) |
lineComponent | Custom line renderer for this node’s outgoing lines (defaults to Line) |
className, style | Presentation for the outer node element |
elementProps | Framework-native attributes and events for the outer node element |
children | Node content; Connector children register against this node |
NodeMirrorContext provides the owning NodeMirror to descendants, and useNodeHandle() returns a callback ref that marks an element as the node’s
dedicated drag surface.
Callback props stay current across renders and compose with callbacks already
present on a supplied core object. During a live pointer gesture, core writes
retained element geometry directly; the batched onGeometryChanged reports
final values for application persistence.
The rendered element carries data-snapline-type="node" and data-selected / data-snapline-state="focus" | "idle" for styling.