Skip to Content
Vue Flow v2 is here and joins xyflow! Read more here →
ReferenceComponents

<NodeResizer />

Source on GitHub 

The <NodeResizer /> component renders draggable controls around a node so users can resize it. Drop it into a custom node.

<!-- ResizableNode.vue --> <script setup lang="ts"> import { Handle, NodeResizer, Position, type NodeProps } from '@xyflow/vue'; defineProps<NodeProps>(); </script> <template> <NodeResizer :min-width="100" :min-height="30" /> <Handle type="target" :position="Position.Left" /> <div>{{ data.label }}</div> <Handle type="source" :position="Position.Right" /> </template>

Props

The type for props of <NodeResizer /> component is exported as NodeResizerProps.

NameTypeDefault
nodeIdstring

Id of the node it is resizing.

colorstring

Color of the resize handle.

handleClassNamestring

Class name applied to handle.

handleStyleCSSProperties

Style applied to handle.

lineClassNamestring

Class name applied to line.

lineStyleCSSProperties

Style applied to line.

isVisibleboolean

Are the controls visible.

true
minWidthnumber

Minimum width of node.

10
minHeightnumber

Minimum height of node.

10
maxWidthnumber

Maximum width of node.

Number.MAX_VALUE
maxHeightnumber

Maximum height of node.

Number.MAX_VALUE
shouldResize(event: ResizeDragEvent, params: ResizeParamsWithDirection) => boolean

Callback to determine if node should resize.

keepAspectRationumber | boolean

Keep aspect ratio when resizing.

false
autoScaleboolean

Scale the controls with the zoom level.

true
onResize((resizeEvent: OnResize) => any) | undefined
onResizeStart((resizeEvent: OnResizeStart) => any) | undefined
onResizeEnd((resizeEvent: OnResizeEnd) => any) | undefined

Notes

  • <NodeResizer /> emits resize-start, resize, and resize-end throughout a resize interaction.
  • Constrain resizing with minWidth / minHeight / maxWidth / maxHeight, or keep proportions with keepAspectRatio.
  • For a single resize control (e.g. only the bottom-right corner) use <NodeResizeControl />.