A simple dropdown menu app which supports a single select and multiple select option type as a prop.
- Install npm/nvm
brew install nvm
brew install npm
- Install node
brew install node@14
- Install modules
npm cache clear --force
npm install
- Start up the project in your local web-browser.
npm start
- If it doesn't automatically open, navigate in web-browser to http://localhost:3000
DropDownMenu takes two props options and type. Options is the dropdown options list and type is the type of dropdown (Multiselect or single select).
Example of options prop:
const data = [
{ label: 'Siddarth Patel' },
{ label: 'Zach Kayyali' },
{ label: 'Sho Weimer' },
{ label: 'Mikela Dockery' },
{ label: 'Stephanny Cocconcelli' },
]
- DropDownMenu with multi select
<DropdownMenu options={data} type='multi' />
- DropDownMenu with single select
<DropdownMenu options={data} type='single' />
- Provide an optional onSelected function prop that returns the selectedItems in dropdown
<DropdownMenu options={DATA} type={TYPES.SINGLE} onSelected={(data) => console.log(data)} />
While the local server is running, go to Constansts.js and manipulate the DATA object as desired
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes.
You may also see any lint errors in the console.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.