0.2.2 • Published 5 years ago

eyzy-tree v0.2.2

Weekly downloads
194
License
MIT
Repository
github
Last release
5 years ago

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

PropertyTypeDescriptionDefault
data (required)arraySpecifies the tree nodes
fetchDatafunctionFetch child node if it has isBatch property
textRendererReactNodeOverrides text container. Gets the Node by argument
arrowRendererReactNodeOverrides arrow container. Gets the Node by argument
checkboxRendererReactNodeOverrides checkbox container. Gets the Node by argument
checkablebooleanAdds a checkbox before the tree nodesfalse
noCascadebooleanWhether to apply checkbox state to child nodes recursivelytrue
useIndeterminateStatebooleanWhether to show indeterminate state for nodetrue
preventSelectParentbooleanWhether to allow to select node which has child (it will expand if true)false
keyboardNavigationbooleanWhether to allow navigate via keyboardtrue
selectOnExpandbooleanWhether to select a node if it has childrenfalse
expandOnSelectbooleanWhether to expand a node if it has childrenfalse
checkOnSelectbooleanSelects a node and changes the state of the checkbox.false
selectOnCheckbooleanWhether to select a node if it checked (during the click)false
themestringAdditional class for tree container.eyzy-theme

Tree Events

PropertyArgumentsDescription
onReadyAPICall once when tree is ready (componentDidMount).
onSelectTreeNodeCalls every time when node is selected.
onUnSelectTreeNodeCalls every time when node is unselected.
onCheckTreeNodeCalls every time when node is checked.
onExpandTreeNodeCalls every time when node is expanded.
onRemoveTreeNodeCalls every time when node is removed.
onAddTreeNodeCalls every time when node is added.
onDoubleClickTreeNodeCalls every time when user do double click on the node. Works only when expandOnSelect is not defined or false

Node Props

PropertyTypeDescription
idstringNode id. If not transmitted, automatically generated.
text (required)stringNode text
childArrayList of child nodes
dataobjectAny type of data
isBatchbooleanCheck the API
classNamestringNode class name
checkablebooleanWhether to possible to check a node (checkbox will be hidden)
loadingbooleanWill be added loading class (indicator is added via CSS)
selectedbooleanWhether to select a node
expandedbooleanWhether to expand a node
checkedbooleanWhether to check a node (if tree is checkable)
disabledbooleanWhether to disable a node
disabledCheckboxbooleanWhether to disable a node's checkbox

Licence

MIT

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.40

5 years ago

0.0.39

5 years ago

0.0.38

5 years ago

0.0.37

5 years ago

0.0.36

5 years ago

0.0.35

5 years ago

0.0.34

5 years ago

0.0.33

5 years ago

0.0.32

5 years ago

0.0.31

5 years ago

0.0.30

5 years ago

0.0.29

5 years ago

0.0.28

5 years ago

0.0.27

5 years ago

0.0.26

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago