<NodeToolbar />
The <NodeToolbar /> component renders a toolbar attached to a node — handy for
per-node actions or a tooltip. It stays in place as you pan and zoom.
<!-- CustomNode.vue -->
<script setup lang="ts">
import { Handle, NodeToolbar, Position, type NodeProps } from '@xyflow/vue';
defineProps<NodeProps>();
</script>
<template>
<NodeToolbar>
<button>delete</button>
<button>copy</button>
<button>expand</button>
</NodeToolbar>
<div>{{ data.label }}</div>
<Handle type="target" :position="Position.Left" />
<Handle type="source" :position="Position.Right" />
</template>Props
The type for props of <NodeToolbar /> component is exported as NodeToolbarProps.
| Name | Type | Default |
|---|---|---|
nodeId | string | string[]By passing in an array of node id’s you can render a single tooltip for a group or collection of nodes. | |
isVisible | booleanIf | |
position | PositionPosition of the toolbar relative to the node. | Position.Top |
offset | numberThe space between the node and the toolbar, measured in pixels. | 10 |
align | "center" | "start" | "end"Align the toolbar relative to the node. | "center" |
Notes
- By default the toolbar is only visible when its node is selected. When multiple
nodes are selected it hides to avoid overlapping toolbars — override this with the
isVisibleprop. - Pass
nodeIdto render the toolbar for a specific node (or an array of ids) from outside that node’s component.