@knadh/autocomp

1.1.0 • Public • Published

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.

/@knadh/autocomp/

    Package Sidebar

    Install

    npm i @knadh/autocomp

    Weekly Downloads

    81

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    5.98 kB

    Total Files

    4

    Last publish

    Collaborators

    • knadh