Skip to content

Node Resizer

In many diagramming scenarios, users need to manually adjust the dimensions of nodes, especially container nodes or text-heavy blocks. yh-flow provides a dedicated NodeResizer component that can be easily embedded into your custom node templates, providing 8-directional scaling handles.

Node Resizer Example

Select the node below; blue resize handles will appear around it. Drag the handles to resize, or drag the node to move it. The demo uses v-model:nodes so that node drag and resize stay in sync with the parent.

Resizable Node
Custom Node Resizing

API Reference

Props

NameTypeDefaultDescription
nodeIdstringRequiredThe ID of the node being resized.
selectedbooleanfalseWhether to display the handles (usually bound to node.selected).
minWidthnumber50Minimum width allowed.
minHeightnumber30Minimum height allowed.
handleStyleCSSProperties{}Custom CSS for the grab handles.

Events

EventParamsDetail
@resize{ width, height, x, y }Fired continuously during dragging. x and y represent coordinate deltas when scaling from top/left borders.
@resizeStartMouseEventFired when the user starts dragging a handle.
@resizeEndMouseEventFired when the resizing is completed.

IMPORTANT

Because NodeResizer utilizes absolute positioning, your custom node container must have position: relative or position: absolute defined in its styles. Otherwise, the handles will float incorrectly outside the node boundaries.

Released under the MIT License.