Skip to Content

<Handle />

Source on GitHub 

The <Handle /> component is used in your custom nodes to define connection points.

import { Handle, Position } from '@xyflow/react'; export const CustomNode = ({ data }) => { return ( <> <div style={{ padding: '10px 20px' }}> {data.label} </div> <Handle type="target" position={Position.Left} /> <Handle type="source" position={Position.Right} /> </> ); };

Props

For TypeScript users, the props type for the <Handle /> component is exported as HandleProps.

NameTypeDefault
idstring | null

Id of the handle.

typeHandleType

Type of the handle.

"source"
positionPosition

The position of the handle relative to the node. In a horizontal flow source handles are typically Position.Right and in a vertical flow they are typically Position.Top.

Position.Top
isConnectableboolean

Should you be able to connect to/from this handle.

true
isConnectableStartboolean

Dictates whether a connection can start from this handle.

true
isConnectableEndboolean

Dictates whether a connection can end on this handle.

true
isValidConnectionIsValidConnection

Called when a connection is dragged to this handle. You can use this callback to perform some custom validation logic based on the connection target and source, for example. Where possible, we recommend you move this logic to the isValidConnection prop on the main ReactFlow component for performance reasons.

onConnectOnConnect

Callback called when connection is made

...propsOmit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "id">
Last updated on