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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@opuscapita/react-treeview

v1.4.0

Published

OpusCapita react treeview component

Downloads

22

Readme

react-tree-component

Description

React Tree Component for showing simple hiearchy structures on the UI. Component is based on rc-tree (https://github.com/react-component/tree) component.

Installation

npm install @opuscapita/react-tree-component

Demo

View the DEMO

Builds

UMD

The default build with compiled styles in the .js file. Also minified version available in the lib/umd directory.

CommonJS/ES Module

You need to configure your module loader to use cjs or es fields of the package.json to use these module types. Also you need to configure sass loader, since all the styles are in sass format.

API

| Prop name | Type | Default | Description | | ------------------------ | ---------------- | ---------------------------------------- | ---------------------------------------- | | treeId | string | defaultTree | Tree identifier | | className | string | '' | Tree container custom class for styling | | iconClass | string | 'carets' | FontAwesome content based indicators: | | | | chevron | nodes as chevrons | | | | carets | nodes as carets | | | | arrow | nodes as arrows | | defaultExpandedKeys | Array | [] | Array of item ids to expand by default | | defaultSelectedKeys | Array | [] | Array of item ids selected by default | | defaultCheckedKeys | Array | [] | Array of item ids checked by default | | onExpand | Function | () => {} | Handling the node expand. Takes 'expandedKeys' as parameter jsx onExpand(expKeys) { console.log(expKeys, arguments); } | | onSelect | Function | () => {} | Handling the item select. Takes 'selectedKeys' and 'info' (event object to get node)as parameter jsx onSelect(selKeys, info) { console.log(selKeys, info); } | | onCheck | Function | () => {} | Handling the item checked | | onDragDrop | Function | () => {} | Fires when item is dragged and dropped | | isDragDropLegal | Function | undefined | This callback is executed before completing drag n' drop action. Function should return a bool |

| | | | Takes 'checkedKeys' and info' (event object to get node) as parameter jsx onCheck (chkKeys, info) { console.log(chkKeys, info); } | | showLine | Boolean | false | Whether show or hide node guide lines | | showIcon | Boolean | false | Whether show or hide node guide lines | | checkable | Boolean | false | Whether show or hide checkboxes from tree| | selectable | Boolean | false | Whether item can be selected. | | disabled | Boolean | false | Disables all node items checkboxes. | | draggable | Boolean | false | Whether item can be dragged around. | | defaultExpandAll | Boolean | false | Expand all nodes by default. | | | | | Note! For better performance do not | | | | | enable this for large dataSets. | | treeData | Array | [] | Array of node objects. | | dataLookUpKey | String | 'key' | Unique identifier of data item. | | dataLookUpValue | String | 'parent' | Representative value of data item. | | dataLookUpChildren | String | 'children' | Data item property to identifiy subitems | | selectedKeys | Array | [] | Array of selected item (ids) |

Code example

import React from 'react';
import { OCTreeView } from '@opuscapita/react-tree-component';   

export default class TreeView extends React.Component {
  const familyData = [
    {
      personId: '100',
      name: 'John Doe',
      siblings: [
        { personId: '100100', name: 'Martha Doe', siblings: [] },
        { personId: '100200', name: 'Jonathan Doe', siblings: [ { personId: '100200100', name: 'Mike Doe', siblings: [] }] },
      ], 
    },
    {
      personId: '200',
      name: 'Haley Miley',
      siblings: [
        { personId: '200100', name: 'Cyrus Miley', siblings: [] },
      ],
    },
  ]; 
  const treeConfig = {
    treeData: exampleData,
    treeId: 'FamilyTree',
    checkable: true,
    selectable: false,
    defaultExpandAll: false,
    showLine: true,
    showIcon: false,
    dataLookUpKey: 'personId',
    dataLookUpValue: 'name',
    dataLookUpChildren: 'siblings',
    disableCheckbox: true,
  };
  render() {
    return (
      <OCTreeView {...treeConfig} />
    );
  }
}