Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

multiselect-react-dropdown

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multiselect-react-dropdown

React multiselect dropdown component with search and various features

  • 1.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
36K
decreased by-7.76%
Maintainers
1
Weekly downloads
 
Created
Source

REACT MULTISELECT DROPDOWN

Version Downloads License PRs Tweet

Description

A React component which provides multi select functionality with various features like selection limit, CSS customization, checkbox, search option, disable preselected values, flat array, keyboard navigation for accessibility and grouping features. Also it has feature to behave like normal dropdown(means single select dropdown).

Multiselect

Getting Started

1. Installation

npm install multiselect-react-dropdown

2. Demo

React-multi-select-dropdown


3. Basic Usage

import { Multiselect } from 'multiselect-react-dropdown';

this.state = {
    options: [{name: 'Srigar', id: 1},{name: 'Sam', id: 2}]
};

<Multiselect
options={this.state.options} // Options to display in the dropdown
selectedvalues={this.state.selectedValue} // Preselected value to persist in dropdown
onSelect={this.onSelect} // Function will trigger on select event
onRemove={this.onRemove} // Function will trigger on remove event
displayValue="name" // Property name to display in the dropdown options
/>

onSelect(optionsList, selectedItem) {
    ...
}

onRemove(optionList, removedItem) {
    ...
}

4. Props

PropTypeDefaultDescription
optionsarray[]Dropdown options
onSelectfunctionfuncCallback function will invoked on select event. Params are selectedList & selectedItem
onRemovefunctionfuncCallback function will invoked on remove event. Params are selectedList & removedItem
singleSelectbooleanfalseMake it true to behave like a normal dropdown(single select dropdown)
selectedValuesarray[]Preselected value to persist in dropdown
showCheckboxboolfalseTo display checkbox option in the dropdown
selectionLimitnumber-1You can limit the number of items that can be selected in a dropdown
placeholderstringSelectPlaceholder text
disablePreSelectedValuesboolfalsePrevent to deselect the preselected values
isObjectbooltrueMake it false to display flat array of string or number Ex. ['Test1',1]
displayValuestringvalueProperty name in the object to display in the dropdown. Refer Basic Usage section
emptyRecordMsgstringNo options availableMessage to display when no records found
groupBystring''Group the popup list items with the corresponding category by the property name in the object
closeIconstringcircleOption to select close icon instead of default. Refer Close Icon section
styleobject{}CSS Customization for multiselect. Refer below object for css customization.
caseSensitiveSearchboolfalseEnables case sensitivity on the search field.
idstring''Id for the input field.

5. CSS Customization

{
  multiselectContainer: { // To change css for multiselect (Width,height,etc..)
	....
  },
  searchBox: { // To change search box element look
	border: none;
	font-size: 10px;
	min-height: 50px;
  },
  inputField: { // To change input field position or margin
      margin: 5px;
  },
  chips: { // To change css chips(Selected options)
	background: red;
  },
  optionContainer: { // To change css for option container 
	border: 2px solid;
  }
  option: { // To change css for dropdown options
	color: blue;
  },
  groupHeading: { // To chanage group heading style
	....
  }
}

6. Close Icons

NameImage
circleClose Icon
circle2Close Icon
cancelClose Icon
closeClose Icon

7. Licence

MIT

Keywords

FAQs

Package last updated on 26 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc