/multi-select-dropdown

A simple dropdown menu component which supports a single select and multiple select option type as a prop.

Primary LanguageJavaScript

Multi Select Dropdown Menu App

A simple dropdown menu app which supports a single select and multiple select option type as a prop.


Quick Start

  1. Install npm/nvm
brew install nvm 
brew install npm
  1. Install node
brew install node@14
  1. Install modules
npm cache clear --force
npm install
  1. Start up the project in your local web-browser.
npm start
  1. If it doesn't automatically open, navigate in web-browser to http://localhost:3000

Usage

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' },
]

  1. DropDownMenu with multi select
    <DropdownMenu options={data} type='multi' />
    
  2. DropDownMenu with single select
    <DropdownMenu options={data} type='single' />
    
  3. Provide an optional onSelected function prop that returns the selectedItems in dropdown
    <DropdownMenu options={DATA} type={TYPES.SINGLE} onSelected={(data) => console.log(data)} />
    

Testing with different data sets

While the local server is running, go to Constansts.js and manipulate the DATA object as desired


Available Scripts

In the project directory, you can run:

npm start

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.

npm run build

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.