A very simple autocomplete component for React


1.4.12 years ago4 years agoMinified + gzip package size for @gluedigital/autocomplete in KB



A very simple autocomplete component with no dependencies.


To install it:

npm install --save @gluedigital/autocomplete

To use it:

import Autocomplete from '@gluedigital/autocomplete'
import '@gluedigital/autocomplete/css/autocomplete.css'
const values = ['Alice', 'Bob', 'Carol']

// ...

  <Autocomplete values={values} name="my-field-name" required />


The following props can be used:

Name Type Description
name string The name to use on the internal input
values array The allowed values
valueLabel string or function If the values are not strings, the field to use as label, or a function to generate it
required bool Whether the input should have the required flag
autoFocus bool Whether the input should have the autoFocus flag
noResultsText string A message for the dropdown when there are no results
placeholder string A placeholder shown when the input is empty
value string The preselected value
onChange func A function that will be called when the selection changes
withClear bool Whether to show a clear button


This package uses nwb for the build. Take a look at their documentation for more info.

TL;DR: after installing nwb, just do npm start to open the dev environment.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.