Skip to Content
✨ Svelte Flow 1.0 is here! Rewritten for Svelte 5 with many new features and improvements.
ReferenceHooksuseNodeConnections()

useNodeConnections()

Source on GitHub 

This hook returns an array of connections on a specific node, handle type (‘source’, ‘target’) or handle ID.

<script> import { useNodeConnections } from '@xyflow/svelte'; const connections = useNodeConnections({ handleType: 'target', handleId: 'my-handle' }); </script> <div>There are currently {connections.length} incoming connections!</div>

Signature

Parameters:
NameTypeDefault
[0]?.idstring
[0]?.handleTypeHandleType
[0]?.handleIdstring
[0]?.onConnect(connections: Connection[]) => void
[0]?.onDisconnect(connections: Connection[]) => void
Returns:

An array with connections

NameType
currentNodeConnection[]
Last updated on