Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/knadh/autocomp.js
A super tiny Javascript autocomplete / autosuggestions library. Zero dependencies, ~800 bytes min+gzip.
https://github.com/knadh/autocomp.js
autocomplete autosuggestions search suggestions typeahead
Last synced: 6 days ago
JSON representation
A super tiny Javascript autocomplete / autosuggestions library. Zero dependencies, ~800 bytes min+gzip.
- Host: GitHub
- URL: https://github.com/knadh/autocomp.js
- Owner: knadh
- License: mit
- Created: 2023-08-27T17:42:34.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-11-30T17:57:23.000Z (11 months ago)
- Last Synced: 2024-10-02T03:25:09.937Z (about 1 month ago)
- Topics: autocomplete, autosuggestions, search, suggestions, typeahead
- Language: JavaScript
- Homepage: https://knadh.github.io/autocomp.js
- Size: 22.5 KB
- Stars: 306
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- zero - autocomp.js
README
# autocomp.js
A super tiny Javascript autocomplete / autosuggestion library. Zero dependencies and ~800 bytes minified + gzipped.
[**View demo**](https://knadh.github.io/autocomp.js)
[![demo](https://github.com/knadh/autocomp.js/assets/547147/8bfaa03c-46a0-4e4e-a127-914120265009)](https://knadh.github.io/autocomp.js)
## Usage
### Node
```shell
npm install @knadh/autocomp
``````javascript
import { autocomp } from @knadh/autocomp;autocomp(document.querySelector("#q"), {
onQuery: async (val) => {
// fetch() or whatever that fetches/generates results.
return ["results", "here"];
},onSelect: (val) => {
alert(val);
return val;
}
});
```Check the [demo source](https://github.com/knadh/autocomp.js/blob/master/docs/index.html) to see advanced usage and basic CSS styles.
### ES6 module
Check the [demo source](https://github.com/knadh/autocomp.js/blob/master/docs/index.html) to use the lib in `` directly on an HTML page.Licensed under the MIT License.