1.0.4 • Published 4 years ago

simple-react-multiselect v1.0.4

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

SIMPLE REACT MULTISELECT DROPDOWN

Getting Started

1. Installation

npm install simple-react-multiselect

2. Basic Usage

import MultiSelect from 'simple-react-multiselect';

this.state = {
    options: [
        {label: 'Srigar', value: 1},
        {label: 'Sam', value: 2}
    ],
    value: [
        {label: 'Srigar', value: 1},
    ],
    loading: false
};

<Multiselect
    options={this.state.options} // options dropdown menu
    value={this.state.value} // pre-selected value
    onInputChanged={this.onInputChanged} // input search value change
    onDropdownOpen={this.onDropdownOpen} // triggers if dropdown menu shown
    onSelectedChange={this.onSelectedChange} // triggers if selected column is changed
    placeholder="placeholder" // placeholder on input
    loading={this.state.loading} // for async request to display loading icon
/>

onSelectedChange(selected) {
    ...
}

onInputChanged(text) {
    ...
}

onDropdownOpen(text) {
    ...
}

3. Props

PropTypeDefaultDescription
optionsarray[]Dropdown options
valuearray[]Preselected items
placeholderstring""Placeholder text
onInputChangedfunctionfuncCallback function will invoked on input value changed
onDropdownOpenfunctionfuncCallback function will invoked on dropdown menu is displayed
onSelectedChangefunctionfuncCallback function will invoked on selected column items changed select, remove, clear
loadingbooleanfalseFor async usage to display loading indicator if fetching for options

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago