Skip to main content

Custom Connection Line

The connection line is the line that gets drawn while you connect two nodes with each other. You can adjust the connection line by using the props documented in the connection line options section. If you want to implement a custom connection line, you can pass a React component to the connectionLineComponent prop. The connection line component will receive the following props:

Connection Line Component Props

NameTypeDescription
sourceXnumberx position of the source handle
sourceYnumbery position of the source handle
sourcePositionPositionposition of the source handle
targetXnumberx position of the target handle
targetYnumbery position of the target handle
targetPositionPositionposition of the target handle
connectionLineTypeConnectionLineTypetype
connectionLineStyleCSS.Propertiesstyle
fromNodeNodethe node where the connection comes from
fromHandleHandleElementthe handle where the connection comes from

You can find an implementation in the custom connection line example.