Utilities for working with @xyflow/react
npm install @unblocks/xyflow-react
A collection of utility functions and classes.
``sh`
npm install @unblocks/xyflow-react
`tsx
import { DagreFlow, createNode, createEdge, Graph } from '@unblocks/xyflow-react';
function MyFlow() {
const graph = new Graph();
graph.addNodes([
createNode({
id: '1',
data: { label: 'Node 1' },
}),
createNode({
id: '2',
data: { label: 'Node 2' },
}),
createNode({
id: '3',
data: { label: 'Node 3' },
}),
]);
graph.addEdges([
createEdge({
source: '1',
target: '2',
}),
createEdge({
source: '1',
target: '3',
}),
]);
const DAGRE_OPTIONS: DagreOptions = { direction: 'TB', nodesep: 80 };
return (
``