# textcomplete

> Autocomplete for textarea elements

Latest version **0.18.2** (published 2020-06-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install textcomplete
pnpm add textcomplete
yarn add textcomplete
bun add textcomplete
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.18.2 |
| Published | 2020-06-10 |
| First published | 2016-02-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 1.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 244 |
| Author | Yuku Takahashi |
| Maintainers | yuku-t |

## Links

- npm: https://www.npmjs.com/package/textcomplete
- Repository: https://github.com/yuku-t/textcomplete
- Homepage: https://github.com/yuku-t/textcomplete#readme
- Issues: https://github.com/yuku-t/textcomplete/issues
- npm.io page: https://npm.io/package/textcomplete

## Dependencies (3)

- [undate](https://npm.io/package/undate.md) ^0.2.3
- [eventemitter3](https://npm.io/package/eventemitter3.md) ^2.0.3
- [textarea-caret](https://npm.io/package/textarea-caret.md) ^3.0.1

## Recent versions

- 0.18.2 (latest) — 2020-06-10
- 0.18.1 — 2019-12-19
- 0.18.0 — 2019-08-06
- 0.17.1 — 2018-03-31
- 0.17.0 — 2018-03-23
- 0.16.1 — 2018-02-28
- 0.16.0 — 2017-12-19
- 0.15.0 — 2017-12-13
- 0.14.5 — 2017-12-05
- 0.14.4 — 2017-11-15
- 0.14.3 — 2017-11-10
- 0.14.2 — 2017-09-25
- 0.14.1 — 2017-09-24
- 0.14.0 — 2017-09-24
- 0.13.1 — 2017-07-03
- … 18 more at https://npm.io/package/textcomplete/versions

## README

# textcomplete

Autocomplete for textarea elements.

[![NPM version](http://img.shields.io/npm/v/textcomplete.svg)](https://www.npmjs.com/package/textcomplete)
[![Build Status](https://travis-ci.org/yuku-t/textcomplete.svg?branch=master)](https://travis-ci.org/yuku-t/textcomplete)
[![Code Climate](https://codeclimate.com/github/yuku-t/textcomplete/badges/gpa.svg)](https://codeclimate.com/github/yuku-t/textcomplete)
[![Test Coverage](https://codeclimate.com/github/yuku-t/textcomplete/badges/coverage.svg)](https://codeclimate.com/github/yuku-t/textcomplete/coverage)
[![Stable Release Size](http://img.badgesize.io/https://unpkg.com/textcomplete/dist/textcomplete.min.js?compression=gzip)](https://github.com/ngryman/badge-size)
[![Analytics](https://ga-beacon.appspot.com/UA-4932407-14/textcomplete/readme)](https://github.com/igrigorik/ga-beacon)

## Requirements

Distributed scripts are self-contained.

To require as npm package, textcomplete requires the following to run:

- [Node.js](https://nodejs.org/)
- [npm] - normally comes with Node.js

## Usage

Textcomplete is easiest to use when installed with [npm]:

```bash
npm install --save textcomplete
```

Then you can load the module into your code with `require` call:

```js
var { Textcomplete, Textarea } = require('textcomplete');
```

The `Textarea` object is a kind of *editor class*. An editor encapsulates an HTML element where users input text. The `Textarea` editor is an editor for textarea element.

You can find some additional editors at [List of editors](https://github.com/yuku-t/textcomplete/wiki/Editors) wiki.

The `Textcomplete` is the core object of textcomplete.

```js
var editor = new Textarea(textareaElement);
var textcomplete = new Textcomplete(editor);
```

Register series of autocomplete strategies:

```js
textcomplete.register([{
  // Emoji strategy
  match: /(^|\s):(\w+)$/,
  search: function (term, callback) {
    callback(emojies.filter(emoji => { return emoji.startsWith(term); }));
  },
  replace: function (value) {
    return '$1:' + value + ': ';
  }
}, {
  // Another strategy
  ...
}]);
```

Now, the `textcomplete` listens keyboard event on the `editor` and render autocomplete dropdown when one of the strategy matches to the inputted value.

## Browser Support

 Chrome  | Firefox  | Internet Explorer |  Opera  | Safari
:-------:|:--------:|:-----------------:|:-------:|:-------:
 Current | Current  |       10+         | Current | Current

## Install

If your project is using npm, you can install [textcomplete](https://www.npmjs.com/package/textcomplete) package by `npm` command:

```bash
npm install --save textcomplete
```

if not, you can download released packages from the [release page](https://github.com/yuku-t/textcomplete/releases) which contain bundled scripts in `dist` directory.

## Contributing

To contribute to textcomplte, clone this repo locally and commit your code on a separate branch.
Please write unit tests for your code, and run the linter before opening a pull-request:

```bash
npm test # run linter and all tests
```

You can find more detail in our [contributing guide](https://github.com/yuku-t/textcomplete/blob/master/CONTRIBUTING.md).

## License

The [MIT](https://github.com/yuku-t/textcomplete/blob/master/LICENSE) License

[npm]: https://www.npmjs.com/

---
_Source: https://npm.io/package/textcomplete · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
