
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
js-family-tree
Advanced tools
A JavaScript library for visualizing and managing family trees using modern web technologies.
Javascript library to create family hierarchy (compactable with all framework & libary).
The Family Tree is a versatile JavaScript library for creating interactive family tree structures in a hierarchical format. It is designed to be lightweight, easy to use, and compatible with any JavaScript framework. With this library, you can visualize family relationships and genealogical data in an intuitive and visually appealing way.
You can install the Family Tree via npm:
npm install js-family-tree
To use the js-family-tree library, you need to pass the family tree data in JSON format. Below is the structure of the JSON data and an example of how to integrate it with your library.
The JSON data should represent the family tree with nodes and relationships. Each person in the family tree is a node with specific attributes. Here's a sample structure:
{ person: { name: "Father", gender: "Male", dob: "09/10/1998", dod: "till", img:
"https://yoururlofimage" }, spouse: { name: "Mother", gender: "Female", dob:
"09/10/1999", dod: "till", img: "https://yoururlofimage" }, children: [ {
person: { name: "Son", gender: "Male", dob: "", dod: "till", img:
"https://yoururlofimage" }, children: [ { person: { name: "Daughter", gender:
"Female", dob: "", dod: "till", img: "https://yoururlofimage" }, spouse: { name:
"Son-in-Law", gender: "Male", dob: "", dod: "till", img:
"https://yoururlofimage" }, children: [ { person: { name: "Him", gender: "Male",
dob: "", dod: "till", img: "https://yoururlofimage" }, spouse: { name: "Her",
gender: "female", dob: "", dod: "till", img: "https://yoururlofimage" },
children: [], }, { person: { name: "Him", gender: "Male", dob: "", dod: "till",
img: "path" }, spouse: { name: "Her", gender: "Female", dob: "", dod: "till",
img: "path" }, children: [], }, ], }, ], };
id
: A unique identifier for each person in the family tree.name
: The name of the person.gender
: The gender of the person. It can be "male"
or "female"
.spouse
: An object representing the person's spouse (if any), with similar attributes (id
, name
, gender
).children
: An array of objects representing the person's children, each with similar attributes (id
, name
, gender
).import { FamilyTree } from "js-family-tree"; const sampleData = {}; function
Dummy() { useEffect(() => { const familyTreeHtml = new FamilyTree(sampleData);
const familyTreeElement = document.getElementById("familyTree"); if
(familyTreeElement) familyTreeElement.innerHTML = familyTreeHtml.render(); },
[]); return (
<div>
<div id="familyTree"></div>
</div>
); }
html file
<div id="familyTreeContainer"></div>
js file
document.addEventListener('DOMContentLoaded', () => { const familyTree = new
FamilyTree({your data as object});
familyTree.render(document.getElementById('familyTreeContainer') ); });
Documentation is currently in progress. Please check back later for updates.
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A JavaScript library for visualizing and managing family trees using modern web technologies.
The npm package js-family-tree receives a total of 13 weekly downloads. As such, js-family-tree popularity was classified as not popular.
We found that js-family-tree demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.