Skip to main content
Version: 4.3

MarkupApi

Markup utilities returned by useMarkup.

Properties

magnetRef

readonly magnetRef: (selector, options?) => (node) => void;

Returns a React ref callback that registers the node under the given selector name AND marks it as a JointJS magnet, a valid endpoint for link connections.

Parameters

ParameterTypeDescription
selectorstringUnique selector name within the element (e.g. 'port-in', 'row-0').
options?MagnetRefOptionsMagnet behavior options.

Returns

(node) => void

Throws

If selector is one of the reserved names (__portal__, root, portRoot).


selectorRef

readonly selectorRef: (selector) => (node) => void;

Returns a React ref callback that registers the node under the given selector name so links and tools can target it by name.

Parameters

ParameterTypeDescription
selectorstringUnique selector name within the element (e.g. 'body', 'item-0').

Returns

(node) => void

Throws

If selector is one of the reserved names (__portal__, root, portRoot).

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub