1.0.15 • Published 5 years ago

react-multipleselect2 v1.0.15

Weekly downloads
29
License
-
Repository
github
Last release
5 years ago

react-multipleselect2

NPM version Downloads

Installation

$ npm install react-multipleselect2 --save

react-multipleselect2 requires React v.16.0.0 and up

Options

ParamTypeRequireDescription
idstringrequireSome unique id, Ex: "multiselect"
dataarrayrequireArray of objects
onChangefuncrequireOn change handler, receives an array of selected items. Ex: ["cat 1", "cat 2"]
classNamestringoptionalAdditional className
formatterfuncoptionalFunction receives item arg and should return formatted string

Usage

import React, { Component } from 'react'
import MultipleSelect from 'react-multipleselect2'
import 'react-multipleselect2/build/styles.css'

export default class Home extends Component {
    render() {
        const data = [{
          label: 'Category 1',
          value: 'some',
          checked: true
        },{
          label: 'Category 2',
          value: 'name',
          checked: false
        },{
          label: 'Category 3',
          value: 'my',
          checked: true
        }]

        return (<div>
            <MultipleSelect
                id="multi-select"
                data={ data }
                onChange={ values => console.log(values) }
                className="select-box"
                formatter={ item => item.label }
            />
        </div>)
    }
}

Demo

Check demo here.

License

MIT

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago