5.0.4 • Published 8 months ago

@licuido-ui/ui_tree-view v5.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

TreeView

The TreeView component is a versatile and customizable tree structure component built with React and Material-UI (MUI). It allows you to display hierarchical data in a tree-like structure, with support for checkboxes, custom icons, and various styling options

Author

Link

Story Book Link SignUp

PlayGround

Try it have a fun codeBox

Installation

npm i  @licuido-ui/ui_tree-view

Import component

import { TreeView } from '@licuido-ui/ui_tree-view';

Usage

import React from 'react';
import { TreeView } from '@licuido-ui/ui_tree-view';

const data = [
  {
    id: 'node-1',
    name: 'Parent Node 1',
    child: [
      {
        id: 'node-1-1',
        name: 'Child Node 1',
      },
      {
        id: 'node-1-2',
        name: 'Child Node 2',
      },
    ],
  },
  {
    id: 'node-2',
    name: 'Parent Node 2',
  },
];

function App() {
  return (
    <TreeView
      state={data}
      checkboxsection={true}
      defaultExpandIcon={<ExpandIcon />}
      defaultCollapseIcon={<CollapseIcon />}
    />
  );
}

export default App;

/>

Image

alt text

Props

PropTypeDefaultDescription
idstring'treeNode'Unique Id for the node.
nodesobject{}Data for the current node and its children.
levelnumber0The level of nesting for the current node.
defaultCollapseIconReact.ReactNode<ExpandIcon />Icon to represent collapsing a node.
defaultExpandIconReact.ReactNode<CollapseIcon />Icon to represent expanding a node.
checkboxWidthstring'1.3rem'Width of the checkbox element.
checkboxHeightstring'1.3rem'Height of the checkbox element.
checkboxBorderRadiusstring'4px'Border radius of the checkbox element.
disablebooleanfalseBoolean flag to disable interaction with the node.
checkboxBgColorstring''Background color for elements.
rightSecobject{ breakpoints: { xs: 6, md: 6, sm: 4, lg: 6 } }Configuration for the right section of the node.
leftSecobject{ breakpoints: { xs: 6, md: 6, sm: 8, lg: 6 } }Configuration for the left section of the node.
permissionHeadingSxobject{}Styling for permission headings.
checkboxsectionbooleanfalseBoolean flag to include checkbox section.
statearray[]State data for managing permissions.
teststring''A test flag indicating the type of node (e.g., 'parent', 'child').
parentIconReact.ReactNode<></>Icon for a parent node.
parentChildIconReact.ReactNode<></>Icon for a parent-child node.
labelStyleobject{}Styling for the node label.
childrenLabelStyleobject{}Styling for children node labels.
subChildLabelStyleobject{}Styling for sub-child node labels.
handleDataChangefunction(updatedNodeSet) => undefinedFunction to handle data changes.
rootStyleobject{}Styling for the root element.
entireGridContainerSxobject{}Styling for the entire grid container.
leftSectionWrapperSxobject{}Styling for the left section wrapper.
rightSecWrapperSxobject{}Styling for the right section wrapper.
checkBoxStyleobject{}Styling for checkboxes.
horizontalBorderSxobject{}Styling for horizontal borders.
expandIconStyleobject{}Styling for expand icons.
collapseIconStyleobject{}Divider is shown from a header bottom.
dividerShownboolean{}Styling for collapse icons.
leftBorderStylebooleanfalseBoolean flag indicating if the node is the last child.
leftborderHalfLeftbooleanfalseBoolean flag indicating if the node is the last child.
connectorsbooleanfalseTo show or hide connectors.
lastIndexbooleanfalseBoolean flag indicating if the node is the last child.
headerTextVariantstring'body2'Variant for the header left text using a props name is headerTextVariant.
headerLeftTextVariantstring'body2'Variant for the header left text using a props name is headerLeftTextVariant.