npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-charts-x

v1.0.6

Published

A modern, interactive organizational chart component for React with D3.js visualization

Readme

react-charts-x

npm downloads license

A modern, interactive organizational chart component for React with D3.js visualization. Perfect for displaying company hierarchies, team structures, and reporting relationships.

Features

  • 🎨 Modern Design - Clean, professional interface with smooth interactions
  • 🔄 Interactive Navigation - Click through organizational levels dynamically
  • 📏 Compact Mode - Smartly collapses older columns to save screen space while keeping context
  • 📊 D3.js Powered - Robust visualization with automatic layout management
  • 🎯 TypeScript Support - Full type definitions included
  • 🪶 Lightweight - Minimal dependencies, optimized bundle size
  • 📱 Responsive - Adapts to different screen sizes

Installation

npm install react-charts-x d3
pnpm add react-charts-x d3
yarn add react-charts-x d3

Note: d3 is a peer dependency and must be installed separately.

Usage

Basic Example

import { ReactChartX, IReactChartXNode } from 'react-charts-x';

function App() {
  const orgData: IReactChartXNode = {
    id: '1',
    name: 'Jane Doe',
    title: 'CEO',
    image: 'https://example.com/jane.jpg',
    total_children: 2,
    children: [
      {
        id: '2',
        name: 'John Smith',
        title: 'CTO',
        total_children: 3,
        children: [
          {
            id: '3',
            name: 'Alice Johnson',
            title: 'Engineering Manager',
            total_children: 0,
            children: []
          }
          // ... more employees
        ]
      },
      // ... more direct reports
    ]
  };

  return <ReactChartX data={orgData} />;
}

With Synthetic Root (Multiple Top-Level Employees)

If you have multiple employees without a common parent (e.g., multiple CEOs or independent teams), use a synthetic root:

import { ReactChartX, IReactChartXNode } from 'react-charts-x';

function App() {
  const employees: IReactChartXNode[] = [
    // Array of top-level employees from your API
  ];

  const ceo = employees.find(e => e.total_children > 0);
  const noReporters = employees.filter(e => e.total_children === 0);

  const syntheticRoot: IReactChartXNode = {
    id: 'synthetic-root',
    name: '',
    title: '',
    total_children: (ceo ? 1 : 0) + noReporters.length,
    children: [...(ceo ? [ceo] : []), ...noReporters]
  };

  return <ReactChartX data={syntheticRoot} />;
}

API Reference

ReactChartX Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | data | IReactChartXNode | Yes | Root node of the organizational hierarchy |

IReactChartXNode Interface

interface IReactChartXNode {
  id: string;             // Unique identifier (formerly empId)
  name: string;           // Name of the entity
  title?: string;         // Title/Role (formerly designation)
  image?: string;         // URL to image (formerly photo)
  total_children?: number;// Number of direct reports
  children?: IReactChartXNode[]; // Array of children nodes
  // ... any other custom properties
}

styleOptions Prop

You can customize the appearance of the chart by passing a styleOptions object:

| Option | Type | Default | Description | |--------|------|---------|-------------| | activeColor | string | #00cb6c | Color for the active path and connector lines | | connectorColor | string | #CCCCCC | Color for inactive connector lines | | textColor | string | #000000 | Main text color | | backgroundColor | string | activeColor + opacity | Background color for active cards | | cardColor | string | #ffffff | Background color for inactive cards | | cardTextColor | string | #666666 | Color for employee name text | | cardTitleColor | string | #666666 | Color for designation title text |

Styling

The component now uses pure CSS (inline styles). It works out-of-the-box in any project.

Customizing Colors Example

<ReactChartX 
  data={data}
  styleOptions={{
    activeColor: '#3b82f6', // Blue
    connectorColor: '#e5e7eb',
    textColor: '#1f2937',
    cardColor: '#f3f4f6',
    cardTextColor: '#111827',
    cardTitleColor: '#6b7280'
  }}
/>

Browser Support

  • Chrome/Edge (latest)
  • Firefox (latest)
  • Safari (latest)

Dependencies

  • react ^16.8.0 || ^17.0.0 || ^18.0.0
  • react-dom ^16.8.0 || ^17.0.0 || ^18.0.0
  • d3 ^7.0.0

License

MIT © Sonjit Saha

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues or have questions, please open an issue.