Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/knadh/floatype.js

A tiny, zero-dependency, floating autocomplete / autosuggestion widget for textareas.
https://github.com/knadh/floatype.js

autocomplete autosuggestion floating-widget suggestions textarea textarea-autocomplete type-ahead

Last synced: 11 days ago
JSON representation

A tiny, zero-dependency, floating autocomplete / autosuggestion widget for textareas.

Awesome Lists containing this project

README

        

# floatype.js

A super tiny Javascript autocomplete / autosuggestion library for rendering floating suggestion widgets in textareas. Zero dependencies and ~1200 bytes minified + gzipped.

[**View demo**](https://knadh.github.io/floatype.js)

![demo](https://github.com/knadh/floatype.js/assets/547147/d4525e83-da4d-46a1-8ebe-203d49ed0115)

## Usage

### Node
```shell
npm install @knadh/floatype
```

```javascript
import { floatype } from @knadh/floatype;

floatype(document.querySelector("textarea"), {
onQuery: async (val) => {
// fetch() or whatever that fetches/generates results.
return ["results", "here"];
}
});
```

Check the [demo source](https://github.com/knadh/floatype.js/blob/master/docs/index.html) to see advanced usage and basic CSS styles.

### ES6 module
Check the [demo source](https://github.com/knadh/floatype.js/blob/master/docs/index.html) to use the lib in `` directly on an HTML page.

> For dropdown suggestions on input boxes, see [autocomp.js](https://github.com/knadh/autocomp.js)

Licensed under the MIT License.