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

useHandle()

Source on GitHub 

The useHandle composable exposes the low-level connect logic — both drag-to-connect and click-to-connect — that powers the <Handle /> component. It returns handlePointerDown and handleClick handlers you wire to your own element. Most of the time you should use <Handle />; reach for useHandle only when you need a fully custom handle element.

<script setup lang="ts"> import { useHandle } from '@xyflow/vue'; const { handlePointerDown, handleClick } = useHandle({ nodeId: 'node-1', handleId: 'a', type: 'source', }); </script> <template> <div @pointerdown="handlePointerDown" @click="handleClick" /> </template>

Signature

Parameters:
NameTypeDefault
handleIdMaybeRefOrGetter<string | null>
nodeIdMaybeRefOrGetter<string>
typeMaybeRefOrGetter<HandleType>
isValidConnectionMaybeRefOrGetter<IsValidConnection | null>
reconnectHandleTypeMaybeRefOrGetter<HandleType>
onReconnectStart(event: MouseTouchEvent) => void
onReconnect(event: MouseTouchEvent, connection: Connection) => void
onReconnectEnd(event: MouseTouchEvent, connectionState: FinalConnectionState<InternalNode<Node<Record<string, unknown>, string | undefined>>>) => void
Returns:
NameType
handlePointerDown(event: MouseTouchEvent) => void
handleClick(event: MouseEvent) => void