# @code4bones/react-tree-menu-property-grid

> Tree Menu with Property Grid

Latest version **1.0.3** (published 2023-01-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @code4bones/react-tree-menu-property-grid
pnpm add @code4bones/react-tree-menu-property-grid
yarn add @code4bones/react-tree-menu-property-grid
bun add @code4bones/react-tree-menu-property-grid
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2023-01-25 |
| First published | 2022-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 129.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | code4bones |
| Maintainers | code4bones |
| Keywords | Tree, Menu, TreeMenu, Sidebar Navigation, Property Grid, React, Typescript, Less, Storybook |

## Links

- npm: https://www.npmjs.com/package/@code4bones/react-tree-menu-property-grid
- Repository: https://github.com/code4bones/react-tree-menu-property-grid
- Homepage: https://github.com/code4bones/react-tree-menu-property-grid/wiki
- Issues: https://github.com/code4bones/react-tree-menu-property-grid/issues
- npm.io page: https://npm.io/package/@code4bones/react-tree-menu-property-grid

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2023-01-25
- 1.0.2 — 2022-11-07

## README

### TreeMenu / PropertyGrid

![npm](https://img.shields.io/npm/v/@code4bones/react-tree-menu-property-grid?label=latest) ![npm](https://img.shields.io/npm/dt/@code4bones/react-tree-menu-property-grid?style=flat-square&label=installs)

### System default / Custom theme 

![sample](https://github.com/code4bones/react-c4b-ui/blob/master/img/theme.png?raw=true "sample")

|feature|sample|
|-------|------|
|![cap](https://github.com/code4bones/react-tree-menu-property-grid/blob/master/img/controls.gif?raw=true)|![cap](https://github.com/code4bones/react-tree-menu-property-grid/blob/master/img/reveal.gif?raw=true)  |
![cap](https://github.com/code4bones/react-tree-menu-property-grid/blob/master/img/folders.gif?raw=true)|![cap](https://github.com/code4bones/react-tree-menu-property-grid/blob/master/img/group-right.gif?raw=true)|

clone, samples available via `yarn storybook` 

#### Brief

yarn add `@code4bones/react-tree-menu-property-grid`

```tsx

import  {TreeMenu, TreeMenuActions,TreeMenuItem }  from "@code4bones/react-tree-menu-property-grid";
import "@code4bones/react-tree-menu-property-grid/build/styles.css";

const ITEMS : TreeMenuItem[] = [{
  id:"item1",
  title:"Item 1",
  // other TreeMenuItem's props
    childs:[{
     id:"sub",
     title:"Subitem 1",
   }]
}];

// if your need to use exponsed actions
const ref = createRef<TreeMenuActions>();

<TreeMenu
  ref={ref}
  items={ITEMS}
  onClick={onClick} 
/>

```

### Properties

type `RenderFn` = (item:MenuItem) => React.ReactElement | undefined | null; 
type `RenderType` = `RenderFn` | React.ReactElement; 


| Propery name | Description                    | Signature
| ------------- | ------------------------------ | ---- |
| `treeID` | tree id | string |
| `propertyGrid` | property grid mode | boolean |
| `items[]`      | tree menu items array       | `TreeMenuItem`[] |
| `ref`      | handle to TreeMenu methods       | `TreeMenuActions` |
| `initialCollapsed`   |  initial tree state     | boolean |
| `initialSelected`   |  initial selected item     | item's `id` : string|
| `theme`   | theme override class name     | `dark`, `light`, custom name | 
| `classPrefix`   | container global prefix     | string |
| `enableRotate` | Rotate collapse / expand icon| boolean |
| `infoStyle` | global custom style | boolean |
| `titleStyle` | global custom style | boolean |
| `infoReveal` | global info display modes | "always" | "vertical" | "horizontal" |
| `badgeVisible` | display badge | boolean |
| `groupIconLeft` | group icon position | boolean |
| `onClick`   |  item click handler     | onClick?:(item:TreeMenuItem) => void|
| `onToggle`   |  collapse  / expand     | onToggle?:(id?:string,collapsed?:boolean) => void;|
| `renderBadge`   |  item click handler     | `RenderType` |
| `renderIcon`   |  Left side element of item     | `RenderType` |
| `renderGroupState`   | Group indicator     | `RenderType` |


`TreeMenuItem`

```tsx
    id:string;
    title:string | React.ReactElement;
    info?:string | React.ReactElement;
    badge?:string | React.ReactElement;
    control?:string | JSX.Element;
    infoReveal?:InfoReveal;
    icon?:React.ReactElement;
    badge?:string | React.ReactElement;
    disabled?:boolean;
    unselectable?:boolean;
    titleClass?:string;
    infoClass?:string;
    style?:React.CSSProperties;
    titleStyle?:React.CSSProperties;
    infoStyle?:React.CSSProperties;
```

`TreeMenuActions` ( use `ref` )
```
    enable:(id:string,disable?:boolean) => void;
    getItem:(id:string) => TreeMenuItem | null;
    collapse:(id:string,collapsed?:boolean) => void;
    select:(id:string) => void;
	  invalidate:() => void;
	  rebuild:(items:TreeMenuItem[]) => void;
```

### Sample

Sample available via storybook `yarn storybook`

---
_Source: https://npm.io/package/@code4bones/react-tree-menu-property-grid · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
