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

Drag Handle

You can restrict dragging to a specific part of node, by specifying a class that will act as a dragHandle.

<script lang="ts"> import { SvelteFlow, Controls, Background, type Node, type Edge, } from '@xyflow/svelte'; import DragHandleNode from './DragHandleNode.svelte'; import '@xyflow/svelte/dist/style.css'; const nodeTypes = { dragHandleNode: DragHandleNode, }; let nodes = $state.raw<Node[]>([ { id: '2', type: 'dragHandleNode', // Specify the custom class acting as a drag handle dragHandle: '.custom-drag-handle', style: 'border: 1px solid #ddd;', position: { x: 200, y: 200 }, data: { label: 'Drag Handle', }, }, ]); let edges = $state.raw<Edge[]>([]); </script> <SvelteFlow bind:nodes bind:edges {nodeTypes} fitView> <Controls /> <Background /> </SvelteFlow>
⚠️
To surpress unknown prop warnings in the browser console, please refer to the guide.
Last updated on