autocomp.js
A super tiny Javascript autocomplete / autosuggestions library. Zero depend...
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)
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 to see advanced usage and basic CSS styles.