0.0.5 • Published 2 years ago

mui-treeselect-component v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Installation

mui-rhf-library is available as an npm package.

// with npm
npm install mui-treeselect-component

// with yarn
yarn add mui-treeselect-component

Demo

Check the storybook of the library: https://62a83daf64071006fcdebc72-hrlbgpsqpf.chromatic.com/?path=/story/treeselect--treeselect-component

Usage

Here is a quick example to get you started:

import React from 'react';
import ReactDOM from 'react-dom';
import { Treeselect } from 'mui-treeselect-component';

function App() {
    return (
        <>
            <Treeselect
                data={[
                    { id: '1', item: 'Item 1' },
                    {
                        id: 2,
                        item: 'Item 2',
                        children: [{ id: 3, item: 'Item 3' }]
                    }
                ]}
                label="Treeselect"
                idKey="id"
                valueKey="item"
                onChange={
                    ((value) => {
                        //do something with selected value
                        console.log(value);
                    },
                    (dir = 'ltr'))
                }
            />
        </>
    );
}

ReactDOM.render(<App />, document.querySelector('#app'));

Documentation

Treeselect

PropTypeDefaultDefinition
data*any[]The data of the treeview
label*stringThe label of the textFeild
idKeystring"id"the identifire key in the tree data
valueKeystring"name"the identifire for the value in the tree data
onChangefunction(value)=>{}the callback function to access the selected value
dirrtl or ltrltrdirection of the expand icon of the nodes
emptyLabelstringNo data foundno optoin placeholder when there is no data
defaultValuestringdefault value for label
defaultKeystringdefault id key

Changelog

Please read the changelog for details of what has changed.

mui-treeselect-component