0.0.1 • Published 3 years ago

@pxp-ui/tree v0.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

React Tree Component

Tree component designed for @pxp-ui

Installation

$ npm install @pxp-ui/tree

Basic Usage

import React, { useState } from 'react';
import Tree from '@pxp-ui/tree';

const App = () => {
  const [data, setData] = useState([{
        id: '1',
        label: 'Parent',
        children: [{
          id: '2',
          label: 'Child 1',
        }]
  }]);

  return(
    <TreeMui 
      data={data}
      onSelectedNodes={console.log}
      enableChecked
    />
  )
}

export default App;

Props

NameTypeDefaultDescription
enableCheckedbooleantrueShow a checkbox, which allow select the tree item.
dataArray[]Initial tree data
optionsArrayOptions events for custom menu.
rendernodeThe custom content of the tree item.
onLoadChildrenfunctionCallback fired when the tree item is selected the first time.
onSelectedNodesfunctionCallback fired when tree items are selected/unselected.