Installations
npm install multiselect-react-dropdown
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
14.19.3
NPM Version
6.14.17
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (79.75%)
JavaScript (7.37%)
HTML (6.52%)
CSS (6.36%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
Download Statistics
Total Downloads
6,304,478
Last Day
579
Last Week
579
Last Month
118,746
Last Year
1,879,468
GitHub Statistics
201 Stars
234 Commits
114 Forks
4 Watching
7 Branches
16 Contributors
Bundle Size
20.56 kB
Minified
5.73 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.0.25
Package Id
multiselect-react-dropdown@2.0.25
Unpacked Size
228.40 kB
Size
56.53 kB
File Count
13
NPM Version
6.14.17
Node Version
14.19.3
Total Downloads
Cumulative downloads
Total Downloads
6,304,478
Last day
0%
579
Compared to previous day
Last week
-97.7%
579
Compared to previous week
Last month
-12.4%
118,746
Compared to previous month
Last year
0.2%
1,879,468
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
Dev Dependencies
31
REACT MULTISELECT DROPDOWN
💥💥💥 React Library for Component Lazyloading. Tiny and Efficient. Check it Out 💥💥💥
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).
🎉🎉 New features in >=2.0.0
✨ SSR Support
🍃 Light weight
🚀 Typescript
🏳️🌈 Getting Started
1. Installation 🔧
npm install multiselect-react-dropdown
yarn add multiselect-react-dropdown
2. Demo 👁️
3. Basic Usage 📑
1import Multiselect from 'multiselect-react-dropdown'; 2 3this.state = { 4 options: [{name: 'Option 1️⃣', id: 1},{name: 'Option 2️⃣', id: 2}] 5}; 6 7<Multiselect 8options={this.state.options} // Options to display in the dropdown 9selectedValues={this.state.selectedValue} // Preselected value to persist in dropdown 10onSelect={this.onSelect} // Function will trigger on select event 11onRemove={this.onRemove} // Function will trigger on remove event 12displayValue="name" // Property name to display in the dropdown options 13/> 14 15onSelect(selectedList, selectedItem) { 16 ... 17} 18 19onRemove(selectedList, removedItem) { 20 ... 21}
4. Props 💬
Prop | Type | Default | Description |
---|---|---|---|
options | array | [] | Dropdown options |
onSelect | function | func | Callback function will invoked on select event. Params are selectedList & selectedItem |
onRemove | function | func | Callback function will invoked on remove event. Params are selectedList & removedItem |
singleSelect | boolean | false | Make it true to behave like a normal dropdown(single select dropdown) |
selectedValues | array | [] | Preselected value to persist in dropdown |
showCheckbox | bool | false | To display checkbox option in the dropdown |
selectionLimit | number | -1 | You can limit the number of items that can be selected in a dropdown |
placeholder | string | Select | Placeholder text |
disablePreSelectedValues | bool | false | Prevent to deselect the preselected values |
isObject | bool | true | Make it false to display flat array of string or number Ex. ['Test1',1] |
displayValue | string | value | Property name in the object to display in the dropdown. Refer Basic Usage section |
emptyRecordMsg | string | No options available | Message to display when no records found |
groupBy | string | '' | Group the popup list items with the corresponding category by the property name in the object |
closeIcon | string | circle | Option to select close icon instead of default. Refer Close Icon section |
style | object | {} | CSS Customization for multiselect. Refer below object for css customization. |
caseSensitiveSearch | bool | false | Enables case sensitivity on the search field. |
closeOnSelect | bool | true | Dropdown get closed on select/remove item from options. |
id | string | '' | Id for the multiselect container and input field(In input field it will append '{id}_input'). |
className | string | '' | Class for the multiselect container wrapper. |
avoidHighlightFirstOption | bool | false | Based on flag first option will get highlight whenever optionlist open. |
hidePlaceholder | bool | false | For true, placeholder will be hidden if there is any selected values in multiselect |
disable | bool | false | For true, dropdown will be disabled |
onSearch | function | func | Callback function invoked on search in multiselect, helpful to make api call to load data from api based on search. |
loading | bool | false | If options is fetching from api, in the meantime, we can show loading... message in the list. |
loadingMessage | any | '' | Custom loading message, it can be string or component. |
showArrow | bool | false | For multiselect dropdown by default arrow wont show at the end, If required based on flag we can display |
customArrow | any | undefined | For multiselect dropdown custom arrow option |
keepSearchTerm | bool | false | Whether or not to keep the search value after selecting or removing an item |
customCloseIcon | ReactNode or string | undefined | Custom close icon and can be string or react component(Check demo for reference) |
selectedValueDecorator | (string) => ReactNode | string | v => v | A function that can be used to modify the representation selected value |
optionValueDecorator | (string) => string | v => v | A function that can be used to modify the representation the available options |
5. Ref
as a prop 📌
By using React.createRef() or useRef(), able to access below methods to get or reset selected values
Method Name | Description |
---|---|
resetSelectedValues | Programatically reset selected values and returns promise |
getSelectedItems | Get all selected items |
getSelectedItemsCount | Get selected items count |
1constructor() { 2 this.multiselectRef = React.createRef(); 3} 4 5resetValues() { 6 // By calling the belowe method will reset the selected values programatically 7 this.multiselectRef.current.resetSelectedValues(); 8} 9 10<Multiselect 11options={this.state.options} // Options to display in the dropdown 12ref={this.multiselectRef} 13/> 14
6. CSS Customization 🌈
1{ 2 multiselectContainer: { // To change css for multiselect (Width,height,etc..) 3 .... 4 }, 5 searchBox: { // To change search box element look 6 border: none; 7 font-size: 10px; 8 min-height: 50px; 9 }, 10 inputField: { // To change input field position or margin 11 margin: 5px; 12 }, 13 chips: { // To change css chips(Selected options) 14 background: red; 15 }, 16 optionContainer: { // To change css for option container 17 border: 2px solid; 18 } 19 option: { // To change css for dropdown options 20 color: blue; 21 }, 22 groupHeading: { // To chanage group heading style 23 .... 24 } 25}
7. Close Icons ❌
Name | Image |
---|---|
circle | ![]() |
circle2 | ![]() |
cancel | ![]() |
close | ![]() |
8. Licence 📜
MIT
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 2/19 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/npm-publish.yml:1
- Info: no jobLevel write permissions found
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/srigar/multiselect-react-dropdown/npm-publish.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/srigar/multiselect-react-dropdown/npm-publish.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/npm-publish.yml:21
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 13 are checked with a SAST tool
Reason
49 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5
- Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp
- Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq
- Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr
- Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765
- Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-w5hq-hm5m-4548
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-w5p7-h5w8-2hfq
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
2.6
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to multiselect-react-dropdown
downshift
🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.
wwagner4719-multiselect-react-dropdown
React multiselect dropdown component with search and various features
react-dropdown-select
Customizable dropdown select for react
react-native-element-dropdown
React Native Element Dropdown is a library that provides a customizable dropdown component for React Native applications.