Gathering detailed insights and metrics for react-dropdown
Gathering detailed insights and metrics for react-dropdown
🔽 A dead simple dropdown component for React
npm install react-dropdown
Typescript
Module System
Node Version
NPM Version
95.9
Supply Chain
93.6
Quality
76.1
Maintenance
100
Vulnerability
100
License
JavaScript (78.37%)
CSS (20.45%)
HTML (1.18%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
25,956,854
Last Day
12,967
Last Week
12,967
Last Month
209,955
Last Year
3,745,472
669 Stars
176 Commits
252 Forks
5 Watching
24 Branches
42 Contributors
Minified
Minified + Gzipped
Latest Version
1.11.0
Package Id
react-dropdown@1.11.0
Unpacked Size
23.44 kB
Size
6.97 kB
File Count
6
NPM Version
8.9.0
Node Version
18.2.0
Cumulative downloads
Total Downloads
Last day
0%
12,967
Compared to previous day
Last week
-70.1%
12,967
Compared to previous week
Last month
-8%
209,955
Compared to previous month
Last year
-12.6%
3,745,472
Compared to previous year
1
Simple Dropdown component for React, inspired by react-select
// with npm
$ npm install react-dropdown --save
// with yarn
$ yarn add react-dropdown
If you want to support React version under v0.13, use react-dropdown@v0.6.1
This is the basic usage of react-dropdown
1import Dropdown from 'react-dropdown'; 2import 'react-dropdown/style.css'; 3 4const options = [ 5 'one', 'two', 'three' 6]; 7const defaultOption = options[0]; 8<Dropdown options={options} onChange={this._onSelect} value={defaultOption} placeholder="Select an option" />;
Options
Flat Array options
1 2const options = [ 3 'one', 'two', 'three' 4];
Object Array options
1 2const options = [ 3 { value: 'one', label: 'One' }, 4 { value: 'two', label: 'Two', className: 'myOptionClassName' }, 5 { 6 type: 'group', name: 'group1', items: [ 7 { value: 'three', label: 'Three', className: 'myOptionClassName' }, 8 { value: 'four', label: 'Four' } 9 ] 10 }, 11 { 12 type: 'group', name: 'group2', items: [ 13 { value: 'five', label: 'Five' }, 14 { value: 'six', label: 'Six' } 15 ] 16 } 17];
When using Object options you can add to each option a className string to further customize the dropdown, e.g. adding icons to options
Disabling the Dropdown
Just pass a disabled boolean value to the Dropdown to disable it. This will also give you a .Dropdown-disabled
class on the element, so you can style it yourself.
1<Dropdown disabled onChange={this._onSelect} value={defaultOption} placeholder="Select an option" />;
className
The className
prop is passed down to the wrapper div
, which also has the Dropdown-root
class.
1<Dropdown className='myClassName' />;
controlClassName
The controlClassName
prop is passed down to the control div
, which also has the Dropdown-control
class.
1<Dropdown controlClassName='myControlClassName' />;
placeholderClassName
The placeholderClassName
prop is passed down to the placeholder div
, which also has the Dropdown-placeholder
class.
1<Dropdown placeholderClassName='myPlaceholderClassName' />;
menuClassName
The menuClassName
prop is passed down to the menu div
(the one that opens and closes and holds the options), which also has the Dropdown-menu
class.
1<Dropdown menuClassName='myMenuClassName' />;
arrowClassName
The arrowClassName
prop is passed down to the arrow span
, which also has the Dropdown-arrow
class.
1<Dropdown arrowClassName='myArrowClassName' />;
arrowClosed, arrowOpen
The arrowClosed
& arrowOpen
props enable passing in custom elements for the open/closed state arrows.
1<Dropdown 2 arrowClosed={<span className="arrow-closed" />} 3 arrowOpen={<span className="arrow-open" />} 4/>;
Check more examples in the example folder.
Run example
$ npm start
MIT | Build for CSViz project @Wiredcraft
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 10/30 approved changesets -- score normalized to 3
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
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
94 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-03
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 More