<EdgeToolbar />
The EdgeToolbar component can be used to display a toolbar on a side of the passed x and y coordinates.
CustomEdge.svelte
<script lang="ts">
import { EdgeToolbar, getBezierPath, BaseEdge, type EdgeProps } from '@xyflow/svelte';
let { id, sourceX, sourceY, targetX, targetY }: EdgeProps = $props();
let [edgePath, centerX, centerY] = $derived(
getBezierPath({
sourceX,
sourceY,
targetX,
targetY
})
);
</script>
<BaseEdge {id} path={edgePath} />
<EdgeToolbar edgeId={id} x={centerX} y={centerY} isVisible>
<button>some button</button>
</EdgeToolbar>
Props
Notes
- By default, the toolbar is only visible when an edge is selected. You can override this
behavior by setting the
isVisible
prop totrue
.
Last updated on