Skip to content

code4bones/react-c4b-ui

Repository files navigation

DEPRECATED

moved to React Tree Menu / Property Grid

React Component Library - code4bones react UI

Components

ComponentDescription
TreeMenuNavigation Menu Tree

react-c4b-ui

npmnpm

Links

Change log

System default / custom theme

sample

featuresample
cap
capcap

Install

$ yarn add @code4bones/react-c4b-ui

TreeMenu

Brief

import{TreeMenu,TreeMenuActions,TreeMenuItem}from"@code4bones/react-c4b-ui";import"@code4bones/react-c4b-ui/build/styles.css";constITEMS : TreeMenuItem[]=[{id:"item1",title:"Item 1",// other TreeMenuItem's propschilds:[{id:"sub",title:"Subitem 1",}]}];// if your need to use exponsed actionsconstref=createRef<TreeMenuActions>();<TreeMenuref={ref}items={ITEMS}onClick={onClick}/>

Properties

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

Propery nameDescriptionSignature
items[]tree menu items arrayTreeMenuItem[]
refhandle to TreeMenu methodsTreeMenuActions
onClickitem click handleronClick?:(item:TreeMenuItem) => void
onTogglecollapse / expandonToggle?:(id?:string,collapsed?:boolean) => void;
initialCollapsedinitial tree stateboolean
initialSelectedinitial selected itemitem's id : string
renderBadgeitem click handlerRenderType
renderIconLeft side element of itemRenderType
renderGroupStateGroup indicatorRenderType
themetheme override class namedark, light, custom name
classPrefixcontainer global prefixstring
enableRotateRotate collapse / expandboolean

TreeMenuItem

 id:string; title:string|React.ReactElement; info?:string|React.ReactElement; 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; 

Sample

Sample available via storybook yarn storybook

About

React React Tree Menu Navigation Library

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published