react-family-tree
TypeScript icon, indicating that this package has built-in type declarations

3.2.0 • Public • Published

react-family-tree

React component that renders a family tree. Demo.

Install

npm i -S react-family-tree

Usage

import ReactFamilyTree from 'react-family-tree';
import FamilyNode from './your-components/FamilyNode';

const WIDTH = 70;
const HEIGHT = 80;

<ReactFamilyTree
    nodes={[...]}
    rootId={rootId}
    width={WIDTH}
    height={HEIGHT}
    renderNode={(node) => (
        <FamilyNode
            key={node.id}
            node={node}
            style={{
                width: WIDTH,
                height: HEIGHT,
                transform: `translate(${node.left * (WIDTH / 2)}px, ${node.top * (HEIGHT / 2)}px)`,
            }}
        />
    )}
/>

Package Sidebar

Install

npm i react-family-tree

Weekly Downloads

254

Version

3.2.0

License

MIT

Unpacked Size

4.68 kB

Total Files

7

Last publish

Collaborators

  • sanich