| title | The BaseEdge component |
|---|---|
| sidebarTitle | <BaseEdge /> |
| description | The BaseEdge component gets used internally for all the edges. It can be used inside a custom edge and handles the invisible helper edge and the edge label for you. |
The <BaseEdge /> component gets used internally for all the edges. It can be
used inside a custom edge and handles the invisible helper edge and the edge label
for you.
import { BaseEdge } from '@xyflow/react';
export function CustomEdge({ sourceX, sourceY, targetX, targetY, ...props }) {
const [edgePath] = getStraightPath({
sourceX,
sourceY,
targetX,
targetY,
});
const { label, labelStyle, markerStart, markerEnd, interactionWidth } = props;
return (
<BaseEdge
path={edgePath}
label={label}
labelStyle={labelStyle}
markerEnd={markerEnd}
markerStart={markerStart}
interactionWidth={interactionWidth}
/>
);
}- If you want to use an edge marker with the
<BaseEdge />component, you can pass themarkerStartormarkerEndprops passed to your custom edge through to the<BaseEdge />component. You can see all the props passed to a custom edge by looking at theEdgePropstype.