# react-geocomplete

> A React autosuggest/autocomplete for the Google Maps Places API. Also comes with a validation component.

Latest version **0.0.7** (published 2016-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-geocomplete
pnpm add react-geocomplete
yarn add react-geocomplete
bun add react-geocomplete
```

## 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.0.7 |
| Published | 2016-08-22 |
| First published | 2016-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Max Kuipers |
| Maintainers | mkuipers |
| Keywords | react, react-component, google, autosuggest, places, validate, validation |

## Links

- npm: https://www.npmjs.com/package/react-geocomplete
- Repository: https://github.com/UrbanBound/react-geocomplete
- Issues: https://github.com/UrbanBound/react-geocomplete/issues
- npm.io page: https://npm.io/package/react-geocomplete

## Dependencies (4)

- [classnames](https://npm.io/package/classnames.md) ^2.2.3
- [lodash.debounce](https://npm.io/package/lodash.debounce.md) ^4.0.6
- [react-addons-shallow-compare](https://npm.io/package/react-addons-shallow-compare.md) ^0.14.8
- [babel-plugin-transform-object-rest-spread](https://npm.io/package/babel-plugin-transform-object-rest-spread.md) ^6.8.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

- 0.0.7 (latest) — 2016-08-22
- 0.0.6 — 2016-08-21
- 0.0.5 — 2016-08-21
- 0.0.4 — 2016-08-21
- 0.0.3 — 2016-08-21
- 0.0.2 — 2016-08-21

## README

# React Geocomplete

A [React](http://facebook.github.io/react/) autosuggest for the Google Maps Places API. This is based on [Ubilabs' Geosuggest](https://github.com/ubilabs/react-geosuggest). For rundown of important differences, please see below.


## Differences from Ubilabs' Geosuggest
* This component includes a ValidatedGeocomplete component for rendering validation errors
* The onSuggestSelect for the base component does not fire when no suggest is selected when no suggests are found (See [this issue](https://github.com/ubilabs/react-geosuggest/issues/191))
* This package does not require React 15
* Both components have a `value()` getter method.

## Installation

As this component uses the Google Maps Places API to get suggests, you must include the Google Maps Places API in the `<head>` of your HTML:

```html
<!DOCTYPE html>
  <html>
  <head>
    …
    <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY_HERE&libraries=places"></script>
  </head>
  <body>
    …
  </body>
</html>
```

Visit the [Google Developer Console](https://console.developers.google.com) to generate your API key.

The easiest way to use geocomplete is to install it from NPM and include it in your own React build process (using [Browserify](http://browserify.org), [Webpack](http://webpack.github.io/), etc).

You might also be able to use the standalone build by including `dist/react-geosuggest.js` in your page. If you use this, make sure you have already included React, and it is available as a global variable. I've never been able to get this to work though.

```
npm install react-geocomplete --save
```

## Usage

For using the base component, please see [Ubilabs documentation](https://github.com/ubilabs/react-geosuggest/tree/v1.24.1). It's mostly the same as that.

### ValidatedGeocomplete
The ValidatedGeocomplete is very similar to the Geocomplete component, except that it allows you to validate that your input matches an autocomplete description or that the field is required.  You can provide a custom component for the validation errors.

#### Properties
##### notFoundErrorComponent
Type: `Component` Default: `null`
This  element, when provided, will impose a validation constraint on the element that its value must match an autocomplete suggestion description. The `notFoundErrorComponent` component may make use of the `userInput` property which will be passed to it.

Type: `Component` Default: `null`
This  element, when provided, will impose a validation constraint on the element that its value must be present.

## License

See [LICENSE.md](LICENSE.md)

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