2.0.0 • Published 5 years ago

react-multiselect-dd v2.0.0

Weekly downloads
6
License
MIT
Repository
-
Last release
5 years ago

React Multi Select Dropdown

A reactjs multiselect dropdown with search functionality and multiple other options.

Features!

  • Support search on tree view structure
  • Provides options for update UI according current theme

Demo: https://sanjayv.github.io/react-multiselect-dd/

Installation

npm install react-multiselect-dd

Setup :

Import module in your app.module.ts:

import Multiselect from "react-multiselect-dd";
...

<Multiselect
    data={sampleData}
    onChange={getSelected}
    showSelected={2}/>

sampleData format

const sampleData = [
    {
        value: 1,
        text: "First",
        child: [
            {
                value: 2,
                text: "First.1",
                child: [
                    {
                        value: 3,
                        text: "First.1.1"
                    }
                ]
            }
        ]
    },
    {
        value: 4,
        text: "Second",
    },
    ...
];

Other options (optional) :

NameTypeDescriptionRequiredDefault
dataArrayData array that use in multiselect dropdownYes[]
onChangeFunctionCallback function that use for get selected valuesYes
showSelectedNumberMax limit of display selected item in input, after that it will display total selected count.No2
customStyleObjectDetail hereNo
Custom Style

You can update Dropdown style according requirments. Following Custome Styles available:

NameTypeDescriptionDefault
inputHeightNumberUse for set Dropdown input height40
inputWidthNumberUse for set Dropdown input width360
checkedColorStringUse for set checked box checked color'#e6783b'
optionHeightNumberUse for set dropdown option height400

You can pass following options in customStyle props.

<Multiselect
    data={sampleData}
    onChange={getSelected}
    showSelected={2}
    customStyle={{
        'optionHeight': 400,
        'checkedColor': '#e6783b',
        'inputHeight': 40,
        'inputWidth': 360
    }}
/>

License

MIT Licensed. Copyright (c) 2019 sanjay verma

Your contributions and suggestions are always welcome :)