# instatype

> Simple React Typeahead

Latest version **1.0.16** (published 2017-03-11) · MIT license · 0 weekly downloads

## Install

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

## 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.0.16 |
| Published | 2017-03-11 |
| First published | 2015-06-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 48 |
| Author | Gabe Ragland |
| Maintainers | gragland |
| Keywords | instatype, autocomplete, typeahead, react, react-component |

## Links

- npm: https://www.npmjs.com/package/instatype
- Repository: https://github.com/gragland/instatype
- Issues: https://github.com/gragland/instatype/issues
- npm.io page: https://npm.io/package/instatype

## 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.0.16 (latest) — 2017-03-11
- 1.0.15 — 2016-12-04
- 1.0.14 — 2016-12-03
- 1.0.13 — 2016-12-02
- 1.0.12 — 2016-12-02
- 1.0.11 — 2016-12-02
- 1.0.10 — 2016-12-01
- 1.0.9 — 2016-06-18
- 1.0.8 — 2016-06-18
- 1.0.7 — 2016-06-17
- 1.0.6 — 2015-06-30
- 1.0.5 — 2015-06-25
- 1.0.4 — 2015-06-18
- 1.0.3 — 2015-06-16
- 1.0.2 — 2015-06-16
- … 2 more at https://npm.io/package/instatype/versions

## README

# instatype
A mobile-friendly React autocomplete component

## Demos
<a href="https://unsplash.now.sh">unsplash.now.sh</a> (latest)<br/>
<a href="http://saveyourvines.com">saveyourvines.com</a>

## Install
`npm install instatype --save`

## Contribute
`npm run example` to run the example app with hot loading of instatype source for easy development.

## Usage
```jsx
import React from 'react';
import Instatype from 'instatype';

class Component extends React.Component {

  render() {
    return <Instatype requestHandler={myRequestHandler} selectedHandler={mySelectedHandler}/>;
  }
}
```

## Props

Prop                       |    Description
---------------------------|----------------
`placeholder`              | Placeholder text for input
`limit`                    | Number of results to show in dropdown
`thumbStyle`               | Set result images to "circle" or "square"
`loadingIcon`              | Path to custom loading icon
`requestHandler`           | Required function that fetches data, adds "image" and "name" properties to each object in the response array, and then passes data back to the instatype component. See an example requestHandler function below.
`selectedHandler`              | Required function that is called when a dropdown result is clicked. This will be passed the full object initially used to populate that result in the dropdown.

## Example requestHandler
```js
requestHandlerUsers: function(query, limit, callback){

  $.ajax({
    url: "https://api.instagram.com/v1/users/search",
    dataType: "jsonp",
    data: {
      client_id: this.props.instagramClientId,
      q: query,
      count: limit
    },
    success: function(data) {
      // Instatype expects an "image" and "name" for each result
      var renamedData = data.data.map(function(result){
        result.image = result.profile_picture;
        result.name = result.username;
        return result;
      });
      
      callback(renamedData);
    }
  });

}
```

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