0.1.9 • Published 4 years ago

react-multiselect-with-checkbox v0.1.9

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

#react-multiselect-with-checkbox npm.io

Install

npm install --save react-multiselect-with-checkbox

Usage

import React, { Component } from "react";
import MultipleSelect from "react-multiple-select-dropdown";
import "react-multiple-select-dropdown/dist/index.css";

class YourWrapperComponent extends React.Component {
    state = {
        selectedOptions: null,
    };

    handleChange = selectedOption => {
        this.setState({ selectedOption }, () =>
            console.log(`Option selected:`, this.state.selectedOption),
        );
    };

    render() {
        const options = [
            { value: "sunday", label: "Sunday" },
            { value: "monday", label: "Monday" },
            { value: "tuesday", label: "Tuesday" },
            { value: "wenesday", label: "Wenesday" },
            { value: "thursday", label: "Thursday" },
            { value: "friday", label: "Friday" },
            { value: "saturday", label: "Saturday" },
        ];
        const { selectedOption } = this.state;
        return (
            <MultiSelect
                options={options}
                value={selectedOption}
                onChange={this.handleChange}
            />
        );
    }
}

feel free to report bugs and request feature

License

MIT © aishwarya4shrestha