@unblocks/xyflow-react
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

@unblocks/xyflow-react

Version

A collection of utility functions and classes.

Install

npm install @unblocks/xyflow-react

Example usage

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 (
    <div style={{ width: '100%', height: '400px' }}>
      <DagreFlow graph={graph} dagreOptions={DAGRE_OPTIONS} />
    </div>
  );
}

Readme

Keywords

Package Sidebar

Install

npm i @unblocks/xyflow-react

Weekly Downloads

201

Version

0.3.1

License

Apache-2.0

Unpacked Size

27.6 kB

Total Files

6

Last publish

Collaborators

  • kristw
  • kristw-bot