Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

rmartide/ReactCustomDropdownInput

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Update

Now the value typed is added to the dropdown so you can select it like an option of the array.

handleChange is not needed anymore since the value typed can be handle with handleSelected, you can still use it but it's optional.

Demo

Live demo

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' },
    ];
  • handleSelected -> gets called everytime the user clicks on a dropdown option
 handleSelected = (option) => {
    ///option is the option selected on the dropdown
  }

Optional

  • handleChange -> gets called everytime the user types on the input
handleChange = (value) => {
    //value is the input typed
  }

Usage

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

About

React component. It is an input with dropdown.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.