bsr-tree-virtual
v2.2.30
Published
React component: tree
Downloads
5
Maintainers
Readme
bsr-tree-virtual
React component tree menu
Install
npm install --save bsr-tree-virtual
Usage
import React from 'react';
import {MdOutlineSubdirectoryArrowRight} from "react-icons/md";
import {FaRegPlusSquare, FaRegMinusSquare} from "react-icons/fa";
import {TreeMenu, MenuItem} from "bsr-tree-virtual"
import "bsr-tree-virtual/dist/index.css"
const listItem= []
const m = new MenuItem('Root');
m.AddItem(new MenuItem('sub_root')
.AddItem(new MenuItem('sub_sub_root')
.AddItem(new MenuItem('sub_sub_sub_root')
.AddItem(new MenuItem('pre_final')
.AddItem(new MenuItem('final'))))));
listItem.push(m)
function App() {
return (
<TreeMenu
iconTree={<MdOutlineSubdirectoryArrowRight size={20}/>}
iconClose={<FaRegPlusSquare size={20}/>}
iconOpen={<FaRegMinusSquare size={20}/>}
wight={1000}
height={1000}
items={listItem}
marginItem={20}
itemSize={33}
onClickMenuItem={(tree,ob)=>{
console.log({
text:ob.item.content,
id:ob.item.id,
isOpen:ob.item.isOpen,
isFinal:!ob.item.items||ob.item.items.length===0
})
}}
/>
);
}
export default App;
License
MIT © ionson100