@joint/react
    Preparing search index...

    Variable MeasuredNodeConst

    MeasuredNode: NamedExoticComponent<
        MeasuredNodeProps & RefAttributes<HTMLElement | SVGAElement>,
    > = ...

    Measured node component automatically detects the size of its children and updates the graph element (node) width and height automatically when elements resize.

    It must be used inside renderElement context

    • Paper
    • PaperProps

    Example with a simple div:

    import { MeasuredNode } from '@joint/react';

    function RenderElement() {
    return (
    <MeasuredNode>
    <div style={{ width: 100, height: 50 }}>Content</div>
    </MeasuredNode>
    );
    }

    Example with a simple div without explicit size defined:

    import { MeasuredNode } from '@joint/react';

    function RenderElement() {
    return (
    <MeasuredNode>
    <div style={{ padding: 10 }}>Content</div>
    </MeasuredNode>
    );
    }

    Example with custom size handling:

    import { MeasuredNode } from '@joint/react';
    import type { dia } from '@joint/core';

    function RenderElement() {
    const handleSizeChange = (element: dia.Cell, size: { width: number; height: number }) => {
    console.log('New size:', size);
    element.set('size', { width: size.width + 10, height: size.height + 10 });
    };

    return (
    <MeasuredNode setSize={handleSizeChange}>
    <div style={{ width: 100, height: 50 }}>Content</div>
    </MeasuredNode>
    );
    }