A tiny library (~3.23 kB) for calculating JSON data to family tree nodes and connectors.
🖥 DEMO APP
npm i relatives-treeimport calcTree, { type Node } from 'relatives-tree';
const nodes: Node[] = [
{
id: "1",
gender: "male",
spouses: [],
siblings: [],
parents: [],
children: [
{ id: "2", type: "blood" },
{ id: "3", type: "blood" }
]
},
{
id: "2",
gender: "female",
spouses: [],
siblings: [],
parents: [{ id: "1", type: "blood" }],
children: []
},
{
id: "3",
gender: "male",
spouses: [],
siblings: [],
parents: [{ id: "1", type: "blood" }],
children: []
}
];
const tree = calcTree(nodes, { rootId: "1" });
render(tree);🛠 Canvas example
🛠️ React example
🛠️ Solid example
Please read this documentation before contributing.
MIT