2.0.6 • Published 2 years ago

react-multiple-select-dropdown-lite v2.0.6

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

React Multiple Select Dropdown Lite

A lightweight Multiple/Single Select Pure functional component for react using React-Hooks.

Screenshot

react-multiple-select-dropdown-menu

Install

npm i react-multiple-select-dropdown-lite

Basic Initialization

import React, { useState } from 'react'
import MultiSelect from  'react-multiple-select-dropdown-lite'
import  'react-multiple-select-dropdown-lite/dist/index.css'

const App = () => {

  const [value, setvalue] = useState('')

  const  handleOnchange  =  val  => {
    setvalue(val)
  }

  const  options  = [
    { label:  'Option 1', value:  'option_1'  },
    { label:  'Option 2', value:  'option_2'  },
    { label:  'Option 3', value:  'option_3'  },
    { label:  'Option 4', value:  'option_4'  },
  ]

  return(
    <div className="app">
      <div  className="preview-values">
        <h4>Values</h4>
        {value}
      </div>

      <MultiSelect
        onChange={handleOnchange}
        options={options}
      />
    </div>
)}
export  default App

Features and Roadmap

  • JSON Value
  • Clearable
  • Disable Chip
  • Custom Down Arrow Icon
  • Disabled
  • Select Limit
  • Group
  • Searchable
  • Custom Creatable Value
  • Themeable (using css var)

Props Options

Propstypedefaultdescription
optionsarray""pass options as array of object label : (string or JSX) Options Label value : Option value style : (object) custom style classes : (string) style classes title : must be provide for JSX label example: [ { label : "Option 1", value : "opt_1", style: {textAlign: 'center'}, classes: "classA classB" } ]
widthmove in css var (version 2.0.1)
namestring''specify a name for form
disabledboolfalsedisable input
defaultValuestring | array of object | string array''specify default value
jsonValueboolfalseget value from input as json
singleSelectboolfalseallow one select only
downArrowIconstring | icon | componentSVGSpecify custom down arrow icon
closeIconstring | icon | componentSVGSpecify custom close arrow icon
clearablebooltrueshow / hide close icon to clear value
downArrowbooltrueshow / hide down icon in dropdown
classNamestring | objectspecify custom class
placeholderstringSelect...Input Placeholder
disableChipboolfalsedisable multiple select chips show value or total selected value only
attrobjectset custom attr to element
customValueboolfalsecreate custom options by pressing enter or comma (,)
largeDataboolfalseprevent slow down (DOM) for large amount of data
chipAlternateTextstring(number) Item SelectedShow text when chip disabled.
closeOnSelectbooltrueclose option-menu on select option

Events

PropsParamsDescription
onChangevaluesTrigger on change any value
onMenuOpennullTrigger when menu open
onMenuClosenullTrigger when menu close

CSS Variables

CSS variable applied in .msl-vars class name. |Variable|Default Value| Details |----------|--------------|----------- |--menu-max-height| 400px| Dropdown menu maximum height. |--input-width| 300px| Dropdown input width. |--font-size| 16px| Dropdown font size. |--border-radius| 8px 8px 8px 8px| Dropdown Border Radius. |--active-menu-shadow| 1px 1px 5px 0px gray| Menu Shadow when active. |--line-height| 1.4| fonts line height. |--active-menu-background| white| Dropdown menu background color when active. |--active-menu-radius| var(--border-radius)| Dropdown menu border radius when active.

Change Log

v-2.0.4
  • CSS variables updated
v-2.0.1
  • Provide component width in css vars intead of props
  • Menu rise up at page bottom
  • events added on menu open/close
v-2.0.0
  • React component support as label
  • Search feature improved
  • Custom values grouped
  • Single Select Bug fixed

Sponsor

License

MIT © Arif-Un | Amin | Built for Bit Form

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.0

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.12

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

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