Reconnect Edge
You can make edges reconnectable by using the <EdgeReconnectAnchor />
component. This component is used to create a reconnection point on your custom edges. They behave similar to handles:
- You can start dragging on an
<EdgeReconnectAnchor />
- This starts a new connection process and from the oppsite side of the edge
- You can finish the connection the same way as it had been started from a handle
<script lang="ts">
import {
SvelteFlow,
Background,
type Node,
type Edge,
type EdgeTypes,
} from '@xyflow/svelte';
import '@xyflow/svelte/dist/style.css';
import { initialNodes, initialEdges } from './nodes-and-edges';
import CustomEdge from './CustomEdge.svelte';
let nodes = $state.raw<Node[]>(initialNodes);
let edges = $state.raw<Edge[]>(initialEdges);
const edgeTypes: EdgeTypes = {
custom: CustomEdge,
};
</script>
<SvelteFlow bind:nodes bind:edges {edgeTypes} fitView>
<Background />
</SvelteFlow>
Last updated on