Skip to Content

useNode(id: string)

Source on GitHub 

This hook returns the node with the specified ID. When you subscribe, it will trigger whenever the node changes. This happens when the node is updated (dragged for example). The return value exposes a .current property to access the node.

<script lang="ts"> import { useNode } from '@xyflow/svelte'; const node = useNode('node-id'); $inspect(node.current); </script>

Signature

Parameters:
NameTypeDefault
idstring

The id of the node to get

Returns:

The current node inside a Svelte Flow context

NameType
currentNodeType | undefined