useHandle()
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:| Name | Type | Default |
|---|---|---|
handleId | MaybeRefOrGetter<string | null> | |
nodeId | MaybeRefOrGetter<string> | |
type | MaybeRefOrGetter<HandleType> | |
isValidConnection | MaybeRefOrGetter<IsValidConnection | null> | |
reconnectHandleType | MaybeRefOrGetter<HandleType> | |
onReconnectStart | (event: MouseTouchEvent) => void | |
onReconnect | (event: MouseTouchEvent, connection: Connection) => void | |
onReconnectEnd | (event: MouseTouchEvent, connectionState: FinalConnectionState<InternalNode<Node<Record<string, unknown>, string | undefined>>>) => void |
| Name | Type |
|---|---|
handlePointerDown | (event: MouseTouchEvent) => void |
handleClick | (event: MouseEvent) => void |