Skip to Content
📣 We just released Svelte Flow 1.0 Alpha — try it out and give us your feedback!
ExamplesEdgesConnection Line

Connection Line

A Connection Line is what you see when you click and drag out from a handle. It represents a possible edge and can snap to valid handles in close proximity. You can implement your own Connection Line by passing a Svelte component with slot="connectionLine". The useConnection hook gives you access to the current connection.

<script lang="ts"> import { SvelteFlow, Background, type Edge, type Node, MiniMap, } from '@xyflow/svelte'; import CustomNode from './CustomNode.svelte'; import ConnectionLine from './ConnectionLine.svelte'; import '@xyflow/svelte/dist/style.css'; const nodeTypes = { custom: CustomNode, }; let nodes = $state.raw<Node[]>([ { id: 'connectionline-1', type: 'custom', data: { label: 'Node 1' }, position: { x: 250, y: 5 }, }, ]); let edges = $state.raw<Edge[]>([]); </script> <SvelteFlow bind:nodes bind:edges {nodeTypes} fitView connectionLineComponent={ConnectionLine} > <Background /> <MiniMap /> </SvelteFlow>
⚠️
To surpress unknown prop warnings in the browser console, please refer to the guide.
Last updated on