1.1.1 • Published 2 years ago

multiselection-input v1.1.1

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

multiselection-input

make multiple selection in the selectbox

NPM JavaScript Style Guide

Install

npm install --save multiselection-input

Usage

import React, { Component } from 'react'

import Multiselection from 'multiselection'
import 'multiselection/dist/index.css'

class Example extends Component {
  state = {
    text: ["Create 😄", "React 😄", "Library 😄", "Example 😄"],
    result: []
  }
  handleValue = (result) => {
    this.setState({result})
  }
  render() {
    const {text, retour} = this.state;
    return (
    <>
      <Multiselection
        width={400}
        data={text}
        handleValue={this.handleValue}
        border={'solid 2px red'} 
        margin={'15%'}
      />
      <ul>
         <h4>Selected element</h4>
             {result.map(item => 
                <li key={item}>{item}</li>
             )}
      </ul>
    </>
  }
}

data : is a mandatory prop typeof list of string

handleValue : is a mandatory prop typeof func for retrieving the result of the select

width : is a optional prop typeof number border : is a optional prop typeof string for border style margin : is a optional prop typeof string for margin of the select

License

MIT © elsamanang