React Organizational Chart is a JavaScript library designed for rendering interactive hierarchy trees within React applications. Its primary distinguishing feature is the flexibility to accept any React children as node labels, enabling highly customized and rich node designs, which is a common limitation in many alternative organizational chart libraries. The current stable version is 2.2.1. While the package maintains a notable level of weekly downloads, indicating its continued utility, its development cadence is slow. The latest version was published approximately three years ago, and according to recent analyses, there have been no new releases in the past twelve months, though some minor commits have occurred more recently. It is typically employed for visualizing hierarchical data structures such as corporate organizational charts or family trees, offering styling customization through props for lines and node padding.
npm install react-organizational-chartVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to create a multi-level organizational chart with custom styled nodes and configured line properties.
Ensure that every `Tree` and `TreeNode` component has a `label` prop, e.g., `<TreeNode label={<div>My Label</div>} />`.Verify and update your `react` and `react-dom` packages to meet the minimum version requirement using `npm install react@^16.12.0 react-dom@^16.12.0` or higher compatible versions.
Consider using styled-components or similar CSS-in-JS libraries, or CSS modules, to abstract complex node styling into separate components or stylesheets for better maintainability and reusability.
Be aware of the slow development pace. For new projects or highly active applications, consider evaluating the stability and feature set against current requirements. Report bugs and contribute if possible to help maintain the project.
Ensure that the `label` prop (and any children) are valid React nodes (e.g., JSX elements, strings, numbers, or arrays of these) and not raw objects. Wrap objects in a rendering component if their content needs to be displayed.
Always provide a valid React Node (e.g., `<div>Content</div>`, a string, or another React component) for the `label` prop on both `Tree` and `TreeNode` components.
Run `npm install react-organizational-chart` or `yarn add react-organizational-chart`. Double-check the import statement for typos: `import { Tree, TreeNode } from 'react-organizational-chart';`