# suggestions

> A typeahead component for inputs

Latest version **1.7.1** (published 2020-11-23) · ISC license · 0 weekly downloads

## Install

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

## 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.7.1 |
| Published | 2020-11-23 |
| First published | 2015-10-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 101.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 45 |
| Author | tristen |
| Maintainers | tristen, katydecorah, andrewharvey, scottsfarley93 |
| Keywords | typeahead, autocomplete, component |

## Links

- npm: https://www.npmjs.com/package/suggestions
- Repository: https://github.com/tristen/suggestions
- Homepage: https://github.com/tristen/suggestions#readme
- Issues: https://github.com/tristen/suggestions/issues
- npm.io page: https://npm.io/package/suggestions

## Dependencies (2)

- [fuzzy](https://npm.io/package/fuzzy.md) ^0.1.1
- [xtend](https://npm.io/package/xtend.md) ^4.0.0

## Recent versions

- 1.7.1 (latest) — 2020-11-23
- 1.7.0 — 2019-10-30
- 1.6.0 — 2019-04-29
- 1.5.0 — 2019-03-21
- 1.4.0 — 2019-03-20
- 1.3.4 — 2019-03-07
- 1.3.3 — 2018-02-03
- 1.3.2 — 2017-09-26
- 1.3.1 — 2016-09-12
- 1.3.0 — 2016-05-13
- 1.2.0 — 2016-01-14
- 1.1.3 — 2015-12-18
- 1.1.1 — 2015-12-14
- 1.1.0 — 2015-12-11
- 1.0.3 — 2015-10-31
- … 3 more at https://npm.io/package/suggestions/versions

## README

Suggestions
---

A typeahead component for inputs

[![npm version](http://img.shields.io/npm/v/suggestions.svg)](https://npmjs.org/package/suggestions) [![Circle CI](https://circleci.com/gh/tristen/suggestions/tree/gh-pages.svg?style=svg)](https://circleci.com/gh/tristen/suggestions/tree/gh-pages)

[__Demo__](http://tristen.ca/suggestions/demo/)

### Usage

#### Quick start

``` html
<script src='suggestions.js'></script>

<script>
  var input = document.querySelector('input');
  var data = ['foo', 'bar', 'baz', 'qux'];
  new Suggestions(input, data);
</script>
```

#### Usage with Browserify

```js
var Suggestions = require('suggestions');

var input = document.querySelector('input');
var data = ['foo', 'bar', 'baz', 'qux'];
new Suggestions(input, data);
```

#### Suggestions with options

```js
var Suggestions = require('suggestions');

var input = document.querySelector('input');

var data = [{
  name: 'Roy Eldridge',
  year: 1911
}, {
  name: 'Roy Hargrove',
  year: 1969
}, {
  name: 'Tim Hagans',
  year: 1954
}, {
  name: 'Tom Harrell',
  year: 1946
}, {
  name: 'Freddie Hubbard',
  year: 1938
}, {
  name: 'Nicholas Payton',
  year: 1973
}, {
  name: 'Miles Davis',
  year: 1926
}, {
  name: 'Dizzy Gillespie',
  year: 1917
}, {
  name: 'Rex Stewart',
  year: 1907
}];

var typeahead = new Suggestions(input, data, {
  minLength: 3, // Number of characters typed into an input to trigger suggestions.
  limit: 3 //  Max number of results to display. 
});

typeahead.getItemValue = function(item) {
  return item.name
};

input.addEventListener('change', function() {
  console.log(typeahead.selected); // Current selected item.
});
```

### [`API`](https://github.com/tristen/suggestions/blob/gh-pages/API.md)

### Running locally

    npm install && npm start

`npm start` will run a server on port 9966. Visit http://localhost:9966/demo/
to view the example.

### Testing

    npm run test

### Credit

This project is adapted from https://github.com/marcojetson/type-ahead.js

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