🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-custom-dropdown-input

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-custom-dropdown-input

An input with a custom dropdown

1.0.2
Source
npm
Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

React CustomDropdownInput

It is an input with a dropdown.

The dropdown gets triggered on focus.

The input has the bootstrap class form-control but bootstrap is not needed.

Example

Try it on codesandbox.io

Props

  • values -> is an array and it will be shown as options in the dropdown
const options1 = [
      { id: 1, label: 'John' },
      { id: 2, label: 'Miles' },
      { id: 3, label: 'Charles' },
      { id: 4, label: 'Herbie' },
    ];
  • handleChange -> gets called everytime the user types on the input
handleChange = (value) => {
    //value is the input typed
  }
  • handleSelected -> gets called everytime the user clicks on a dropdown option
 handleSelected = (option) => {
    ///option is the option selected on the dropdown
  }

Usage

<CustomDropdownInput values={options1} handleSelected={this.handleSelected} handleChange={this.handleChange} />

Keywords

dropdown

FAQs

Package last updated on 15 Aug 2018

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