-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor / redo input->autocomp to textarea->floatype.
- Loading branch information
Showing
6 changed files
with
231 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,33 @@ | ||
# autocomp.js | ||
# floatype.js | ||
|
||
A super tiny Javascript autocomplete / autosuggestion library. Zero dependencies and ~800 bytes minified + gzipped. | ||
A super tiny Javascript autocomplete / autosuggestion library. Zero dependencies and ~1200 bytes minified + gzipped. | ||
|
||
[**View demo**](https://knadh.github.io/autocomp.js) | ||
[**View demo**](https://knadh.github.io/floatype.js) | ||
|
||
[![demo](https://github.com/knadh/autocomp.js/assets/547147/8bfaa03c-46a0-4e4e-a127-914120265009)](https://knadh.github.io/autocomp.js) | ||
![demo](https://github.com/knadh/floatype.js/assets/547147/d4525e83-da4d-46a1-8ebe-203d49ed0115) | ||
|
||
|
||
## Usage | ||
|
||
### Node | ||
```shell | ||
npm install @knadh/autocomp | ||
npm install @knadh/floatype | ||
``` | ||
|
||
```javascript | ||
import { autocomp } from @knadh/autocomp; | ||
import { floatype } from @knadh/floatype; | ||
|
||
autocomp(document.querySelector("#q"), { | ||
floatype(document.querySelector("textarea"), { | ||
onQuery: async (val) => { | ||
// fetch() or whatever that fetches/generates results. | ||
return ["results", "here"]; | ||
}, | ||
|
||
onSelect: (val) => { | ||
alert(val); | ||
return val; | ||
} | ||
}); | ||
``` | ||
|
||
Check the [demo source](https://github.com/knadh/autocomp.js/blob/master/docs/index.html) to see advanced usage and basic CSS styles. | ||
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/autocomp.js/blob/master/docs/index.html) to use the lib in `<script>` directly on an HTML page. | ||
Check the [demo source](https://github.com/knadh/floatype.js/blob/master/docs/index.html) to use the lib in `<script>` directly on an HTML page. | ||
|
||
Licensed under the MIT License. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.