# ember-cli-autocomplete-input

> An autocomplete text input for Ember that manages common actions and handles keyboard interactions

Latest version **1.1.0** (published 2018-05-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install ember-cli-autocomplete-input
pnpm add ember-cli-autocomplete-input
yarn add ember-cli-autocomplete-input
bun add ember-cli-autocomplete-input
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-05-11 |
| First published | 2017-06-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^4.5 \|\| 6.* \|\| >= 7.* |
| Dependencies | 4 |
| Unpacked size | 213.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Tim Cook |
| Maintainers | timjcook |
| Keywords | form, input, text, autocomplete, keyboard, ember-addon |

## Links

- npm: https://www.npmjs.com/package/ember-cli-autocomplete-input
- Repository: https://github.com/timjcook/ember-cli-autocomplete-input
- Homepage: https://github.com/timjcook/ember-cli-autocomplete-input#readme
- Issues: https://github.com/timjcook/ember-cli-autocomplete-input/issues
- npm.io page: https://npm.io/package/ember-cli-autocomplete-input

## Dependencies (4)

- [ember-cli-babel](https://npm.io/package/ember-cli-babel.md) ^6.6.0
- [ember-cli-htmlbars](https://npm.io/package/ember-cli-htmlbars.md) ^2.0.1
- [ember-cli-keyboard-nav](https://npm.io/package/ember-cli-keyboard-nav.md) ~1.0.0
- [ember-cli-htmlbars-inline-precompile](https://npm.io/package/ember-cli-htmlbars-inline-precompile.md) ^1.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2018-05-11
- 1.0.7 — 2018-03-28
- 1.0.5 — 2018-02-19
- 1.0.4 — 2017-08-31
- 1.0.2 — 2017-06-30
- 1.0.1 — 2017-06-21
- 1.0.0 — 2017-06-21
- 0.0.3 — 2017-06-21
- 0.0.2 — 2017-06-16
- 0.0.1 — 2017-06-16
- 0.0.0 — 2017-06-16

## README

# ember-cli-autocomplete-input

[![Build Status](https://travis-ci.org/timjcook/ember-cli-autocomplete-input.svg?branch=master)](https://travis-ci.org/timjcook/ember-cli-autocomplete-input)

An autocomplete text input for Ember.
* It provides a hook for updating a list of results based on a change to the current term in the input field.
* It also provides some basic keyboard navigation for quickly accessing items in the results list, including:
  * Enter key - select the currently highlighted result
  * Esc key - clear the search term and the current results
  * Up key - move the highlight to the result above the currently highlighted results
  * Down key - move the highlight to the result below the currently highlighted results

## Installation

* `ember install ember-cli-autocomplete-input`

## Using the component

You can include the component in any of your templates:

```
{{autocomplete-input name=name results=results updateTerm="updateTerm" selectResult="selectResult"}}
```

## Arguments

The `autocomplete-input` component takes the following arguments

### name - String

The name variable will be set on the input tag as both the name attribute as well as the id attribute, allowing focus to be triggered by clicking a label tag.

### results (required) - Array

The results array contains the current list of results objects.

### resultName (optional, default 'name') - String

The attribute on an object in the `results` array that will be used as the display in the results list.

### resultValue (optional, default 'value') - String

The attribute on an object in the `results` array that will be used to check a result to the currently highlighted result in the results list.

## Handling interactions

The `autocomplete-input` component exposes the following actions which respond to user interaction:

### selectResult(result)

This is fired when a result item is clicked or the `enter` key is pressed while a result is highlighted.
The selected result is passed as the only argument.

### updateTerm(term)

This is fired when the term is updated by typing into the bound input field.
Use this action to update your `results` array.

### clearSearch()

This is fired when the `esc` key is pressed.
Use this action handle a clear of the search, ie clear results array and search term.

## License

This project is licensed under the [MIT License](LICENSE.md).

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