
Autocomp.js
https://github.com/knadh/autocomp.js- Category
- Developer Tools
- Rank
- No. 1454Tools index
Previous survey · No. 1461 ·
- Pricing
- Open Source
- Type
- TOOL
- Builder
- knadh
- GitHub
- 351 stars
- Latest release
- v1.0.0
- Date
About
Tiny ~800 byte zero-dependency JavaScript autocomplete and suggestions library.
What it does
Autocomp.js turns an existing input into a suggestion field. Your asynchronous query handler supplies matching items, while the library manages debouncing, dropdown rendering, arrow-key navigation, mouse selection, and optional custom result markup.
Why it's ranked here
The appeal is narrow but convincing: a small browser library handles the core interaction without prescribing a data source. It supports strings and richer objects, yet its absent test suite and minimal accessibility behavior make it better suited to controlled, modest interfaces than demanding design systems.
What's good
The query handler can fetch remote results or filter local data, keeping search policy outside the library. Selection behavior and item rendering are customizable. Built-in debouncing reduces repeated queries, and keyboard navigation cycles through available results. The published package contains only the library module.
Tradeoffs
It supplies no packaged styles, fuzzy matching, caching, request cancellation, or data service. Overlapping asynchronous queries can resolve out of order. The dropdown uses absolute positioning derived from input offsets, which may require care in complex layouts. Results lack explicit ARIA roles and state. The package declares no working test command.
How to use it well
Choose it for a small browser form where you already control result retrieval, styling, and accessibility integration. It fits search boxes and lightweight selectors that need custom objects or markup. Add your own stale-request protection for remote queries. Look elsewhere when you need a complete search engine, managed data, or a fully specified accessible combobox.
Technical notes+
autocomp.js exports named and default autocomp bindings. It attaches input, keydown, and blur listeners, debounces through setTimeout, awaits opt.onQuery, and inserts an .autocomp container after the input. opt.onRender must return a DOM node; opt.onSelect may replace the input value. Navigation uses numeric keyCode values and wraps through results. There is no cancellation or sequence guard for active promises. onNavigate appears in the defaults but is never invoked. package.json publishes only autocomp.js, and its test script deliberately exits with an error. index.html provides inline CSS and examples for strings and object results.
Observed
- License
- MIT License
- Primary language
- JavaScript
- Interface
- Browser-side JavaScript library
- Installation
- Public npm package named @knadh/autocomp
- Module surface
- ES module with named and default exports
- Runtime dependencies
- No dependencies declared
- Published files
- Package configuration includes only autocomp.js
- Testing structure
- The declared test command reports that no test is specified
Read from README.md, package.json, autocomp.js, LICENSE, index.html.
What it can do
Provide autocomplete suggestions for user input
Partial text input → List of suggested completions
Filter suggestions based on user typing
Text input and suggestion dataset → Filtered list of matching suggestions
Display dropdown menu with suggestions
Suggestion list and DOM element → Interactive dropdown interface
Handle keyboard navigation of suggestions
Keyboard events and suggestion list → Highlighted suggestion selection
Auto-complete selected suggestion into input field
Selected suggestion and input field → Completed text in input field
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.