3.0.2 • Published 1 year ago

autosuggest-input-box v3.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
1 year ago

A simple react auto suggest input box

This is a simple, basic auto-suggest input box for React forms. To use it, simply pass in a list of suggestions and retrieve the selected value using a callback function. This component is compatible with TypeScript as well.

Please see the DEMO here

Install

npm

npm install --save autosuggest-input-box

yarn

yarn add autosuggest-input-box

Example

import AutoSuggestInput from "autosuggest-input-box";

const suggestions = ["China","India","United States","Indonesia","Pakistan","Brazil","Nigeria","Bangladesh","Russia","Mexico","Japan","Ethiopia","Philippines","gypt","Vietnam","DR Congo","Turkey","Iran","Germany","Thailand","United Kingdom","France","Italy","Tanzania","SouthAfrica","Myanmar","Kenya","South Korea","Colombia","Spain","Uganda","Argentina","Algeria","Sudan","Ukraine","Iraq","Afghanistan","Poland","Canada","Moocco","Saudi Arabia","Uzbekistan","Peru","Angola","Malaysia","Mozambique","Ghana","Yemen","Nepal","Venezuela"];

const App = () => {
  const onChange = (input) => {
    console.log(input);
  };
  return (
    <div>
      Country:
      <AutoSuggestInput list={suggestions} onChange={onChange} />
    </div>
  );
};

export default App;

API

PropTypeRequiredDescription
liststring[]This contains list of values to be shown as suggestions
onChangeFunctionThis function is used to capture the change in input box. It can be used to update the state in your file.
idStringElement id to uniquely identify the input box in DOM
nameStringElement name to identify the element in form submissions
placeholderStringPlaceholder for the input box
inputStyleCSSPropertiesInput box react style object
listStyleCSSPropertiesList react style object
itemStyleCSSPropertiesItem react style object
itemHoverStyleCSSPropertiesInput hover react style object
classNameStringDeprecated from v1.0.13
2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

3.0.2

1 year ago

3.0.1

1 year ago

3.0.0

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago