Skip to main content
Version: 4.3

MeasureElementOptions

Options for useMeasureElement, controlling how the measured DOM size is turned into the graph element's size.

Properties

transform?

readonly optional transform?: TransformElementLayout;

Adjusts the measured size before it is written to the graph element, e.g. to add padding or reserve space for a header. Receives the measured dimensions plus the element's current layout (TransformElementLayoutParams) and returns the width/height (and optionally x/y) to apply.

Default

When omitted, the measured width/height are applied to the element unchanged.

Example

const transform = ({ width, height }) => ({
width: width + 20, // 10px padding on each side
height: height + 20,
});
useMeasureElement(nodeRef, { transform });

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub