Go to file
Kailash Nadh 75b2b5f82b Bump version for release. 2023-11-30 23:27:18 +05:30
docs Add `tab` support for selection. 2023-11-30 23:27:06 +05:30
LICENSE First commit. 2023-08-27 23:12:41 +05:30
README.md Fix readme image. 2023-08-28 19:47:54 +05:30
autocomp.js Add `tab` support for selection. 2023-11-30 23:27:06 +05:30
package.json Bump version for release. 2023-11-30 23:27:18 +05:30

README.md

autocomp.js

A super tiny Javascript autocomplete / autosuggestion library. Zero dependencies and ~800 bytes minified + gzipped.

View demo

demo

Usage

Node

npm install @knadh/autocomp
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.

ES6 module

Check the demo source to use the lib in <script> directly on an HTML page.

Licensed under the MIT License.