Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/component/autosuggest
Autosuggest values for text inputs
https://github.com/component/autosuggest
Last synced: 12 days ago
JSON representation
Autosuggest values for text inputs
- Host: GitHub
- URL: https://github.com/component/autosuggest
- Owner: component
- Created: 2013-02-26T17:05:23.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-08-21T17:09:11.000Z (over 11 years ago)
- Last Synced: 2024-05-08T17:16:44.282Z (8 months ago)
- Language: JavaScript
- Homepage: http://component.github.io/autosuggest/
- Size: 93.8 KB
- Stars: 31
- Watchers: 8
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# autosuggest
### Autosuggest values for text inputs
`` autosuggest component. [Try the demo][demo]!
Inspired from http://oak.cs.ucla.edu/cs144/projects/javascript/suggest1.html.
## Installation
```bash
$ component install component/autosuggest
```## Example
```js
var autosuggest = require('autosuggest');
var input = document.querySelector('input[type="text"]');// array of suggestions
var suggestions = [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
];// create an `autosuggest` instance
var suggest = autosuggest(input, suggestions);// and you can change the array of suggestions to use if they get change
var newSuggestions = suggestions.concat([ 'Funday' ]);
suggest.set(newSuggestions);
```## API
### autosuggest(el, [suggestions]) → Autosuggest
Returns an `Autosuggest` instance. The instance has `.start()` called on it if the
optional `suggestions` array is given, otherwise you must call `.set(array)` and
`.start()` manually.### .set(array)
Sets a new array of Strings to use as the suggestions for the `Autosuggest`
instance.#### .start()
Starts the autosuggesting for the `Autosuggest` instance.
#### .stop()
Stops the autosuggesting for the `Autosuggest` instance..
## License
MIT
[demo]: http://component.github.com/autosuggest/