0.4.1 • Published 6 years ago

react-svg-tree v0.4.1

Weekly downloads
5
License
MIT
Repository
-
Last release
6 years ago

React SVG Tree

React svg tree

React Tree provides components for rendering tree graphs with svg. It uses the algorithm described in this paper. You can pass in a map of the vertices to render the tree. The component takes a function-as-child which passes in the coordinates and id of the child node, so you can render whatever svg you want.

import { Tree } from 'react-svg-tree';

const vertexMap = new Map([
  [0, [1, 2, 3]],
  [1, [4, 5]],
  [2, []],
  [3, [6]],
  [4, []],
  [5, []],
  [6, []],
]);

const App = () => (
  <Tree width={200} height={75} rootId="O" nodeSize={5} vertices={vertexMap}>
    {({ x, y, id }) => <circle cx={x} cy={y} r={5} />}
  </Tree>
);
0.4.1

6 years ago

0.4.0

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago