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

Connection Limit

This is an example of a custom node with a custom handle that can limit the amount of connections a handle can have using the isConnectable prop. You can use a boolean, a number (the number of max. connections the handle should have) or a callback function that returns a boolean as an arg for the isConnectable prop of the CustomHandle component.

<script lang="ts"> import { writable } from 'svelte/store'; import { SvelteFlow, Background, type Node, type Edge } from '@xyflow/svelte'; import '@xyflow/svelte/dist/style.css'; import CustomNode from './CustomNode.svelte'; import { initialNodes, initialEdges } from './nodes-and-edges'; const nodes = writable<Node[]>(initialNodes); const edges = writable<Edge[]>(initialEdges); const nodeTypes = { custom: CustomNode }; </script> <div style="height:100vh;"> <SvelteFlow {nodes} {edges} {nodeTypes} fitView> <Background /> </SvelteFlow> </div>
⚠️
To surpress unknown prop warnings in the browser console, please refer to the guide.
Last updated on