/react-treeview

Easy, light, flexible tree view made with React.

Primary LanguageJavaScript

React-treeview

Easy, light, flexible treeview made with React.

Demo (Also check out the example/ folder for usage).

install

Npm:

npm install react-treeview

Bower:

bower install react-treeview

The CSS file:

<link rel="stylesheet" type="text/css" href="path/to/react-treeview.css">

API

<TreeView />

The component accepts three props.

  • collapsed: whether the node is collapsed or not.
  • defaultCollapsed: the uncontrolled equivalent to collapsed.
  • nodeLabel: the component or string (or any renderable "thing") that's displayed beside the TreeView arrow.

TreeViews can be naturally nested.

Note: this.transferPropsTo(<TreeView />) will transfer the props to the arrow under the hood. All attributes and events naturally work on it.

Styling

The CSS is flexible, commented and made to be easily customized. Feel free to inspect the demo's classes and check the short CSS code.

License

MIT.