eyzy-tree
React tree component
Last updated 4 months ago by amsik .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install eyzy-tree 
SYNC missed versions from official npm registry.

One more React Tree component

Most expected tree ui component for React.

NPM version NPM license NPM total downloads NPM monthly downloads

Documentation | Examples

assets_-LIk7qYrBMivIw5dM3CP_-LXrbHDPWExqQURbPB5D_-LXrfVI_P7Wt8GJVXrVe_red

Features

  • flexible configuration
  • rich options
  • rich API
  • events for every action
  • keyboard navigation
  • check boxes
  • multi-selection
  • async support

Table of Contents

Getting Started

Installing a package using the package manager.

# NPM
npm install eyzy-tree

# YARN
yarn add eyzy-tree

Connect in browser.

<script src="https://cdn.jsdelivr.net/npm/eyzy-tree/dist/eyzy-tree.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/eyzy-tree/dist/style.css" rel="stylesheet" />

Usage

import React, { Component } from 'react'
import EyzyTree from 'eyzy-tree'
import 'eyzy-tree/style.css'

export default class Tree extends Component {
  constructor(props) {
    super(props);

    this.state = {
      data: [
        { text: 'Item 1' },
        { text: 'Item 2' },
        { text: 'Item 3' },
      ],
    };
  }

  render() {
    return (
      <div style={{ height: 400 }}>
        <EyzyTree
          data={this.state.data}
        />
      </div>
    );
  }
}

Customization

Click here to find out how to configure the component.

Tree Props

Property Type Description Default
data (required) array Specifies the tree nodes
fetchData function Fetch child node if it has isBatch property
textRenderer ReactNode Overrides text container. Gets the Node by argument
arrowRenderer ReactNode Overrides arrow container. Gets the Node by argument
checkboxRenderer ReactNode Overrides checkbox container. Gets the Node by argument
checkable boolean Adds a checkbox before the tree nodes false
noCascade boolean Whether to apply checkbox state to child nodes recursively true
useIndeterminateState boolean Whether to show indeterminate state for node true
preventSelectParent boolean Whether to allow to select node which has child (it will expand if true) false
keyboardNavigation boolean Whether to allow navigate via keyboard true
selectOnExpand boolean Whether to select a node if it has children false
expandOnSelect boolean Whether to expand a node if it has children false
checkOnSelect boolean Selects a node and changes the state of the checkbox. false
selectOnCheck boolean Whether to select a node if it checked (during the click) false
theme string Additional class for tree container. eyzy-theme

Tree Events

Property Arguments Description
onReady API Call once when tree is ready (componentDidMount).
onSelect TreeNode Calls every time when node is selected.
onUnSelect TreeNode Calls every time when node is unselected.
onCheck TreeNode Calls every time when node is checked.
onExpand TreeNode Calls every time when node is expanded.
onRemove TreeNode Calls every time when node is removed.
onAdd TreeNode Calls every time when node is added.
onDoubleClick TreeNode Calls every time when user do double click on the node. Works only when expandOnSelect is not defined or false

Node Props

Property Type Description
id string Node id. If not transmitted, automatically generated.
text (required) string Node text
child Array<TreeNode> List of child nodes
data object Any type of data
isBatch boolean Check the API
className string Node class name
checkable boolean Whether to possible to check a node (checkbox will be hidden)
loading boolean Will be added loading class (indicator is added via CSS)
selected boolean Whether to select a node
expanded boolean Whether to expand a node
checked boolean Whether to check a node (if tree is checkable)
disabled boolean Whether to disable a node
disabledCheckbox boolean Whether to disable a node's checkbox

Licence

MIT

Current Tags

  • 0.2.2                                ...           latest (4 months ago)

45 Versions

  • 0.2.2                                ...           4 months ago
  • 0.2.1                                ...           4 months ago
  • 0.2.0                                ...           4 months ago
  • 0.1.1                                ...           4 months ago
  • 0.1.0                                ...           4 months ago
  • 0.0.40                                ...           4 months ago
  • 0.0.39                                ...           4 months ago
  • 0.0.38                                ...           4 months ago
  • 0.0.37                                ...           5 months ago
  • 0.0.36                                ...           5 months ago
  • 0.0.35                                ...           5 months ago
  • 0.0.34                                ...           5 months ago
  • 0.0.33                                ...           5 months ago
  • 0.0.32                                ...           5 months ago
  • 0.0.31                                ...           5 months ago
  • 0.0.30                                ...           5 months ago
  • 0.0.29                                ...           5 months ago
  • 0.0.28                                ...           5 months ago
  • 0.0.27                                ...           6 months ago
  • 0.0.26                                ...           6 months ago
  • 0.0.25                                ...           6 months ago
  • 0.0.24                                ...           6 months ago
  • 0.0.23                                ...           6 months ago
  • 0.0.22                                ...           7 months ago
  • 0.0.21                                ...           7 months ago
  • 0.0.20                                ...           7 months ago
  • 0.0.19                                ...           7 months ago
  • 0.0.18                                ...           7 months ago
  • 0.0.17                                ...           7 months ago
  • 0.0.16                                ...           7 months ago
  • 0.0.15                                ...           8 months ago
  • 0.0.14                                ...           8 months ago
  • 0.0.13                                ...           8 months ago
  • 0.0.12                                ...           8 months ago
  • 0.0.11                                ...           8 months ago
  • 0.0.10                                ...           8 months ago
  • 0.0.9                                ...           8 months ago
  • 0.0.8                                ...           8 months ago
  • 0.0.7                                ...           8 months ago
  • 0.0.6                                ...           9 months ago
  • 0.0.5                                ...           9 months ago
  • 0.0.4                                ...           9 months ago
  • 0.0.3                                ...           9 months ago
  • 0.0.2                                ...           10 months ago
  • 0.0.1                                ...           10 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 10
Last Day 0
Last Week 1
Last Month 97
Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |