1.1.1 • Published 1 year ago

google-places-suggester v1.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Google Places Auto Complete

npm install google-places-suggester

React Places Autocomplete

A React component to build a customized UI for Google Maps Places Autocomplete

  1. Enable you to easily build a customized autocomplete dropdown powered by Google Maps Places Library
  2. Utility functions to geocode and get latitude and longitude using Google Maps Geocoder API
  3. Full control over rendering to integrate well with other libraries (e.g. Redux-Form)
  4. Mobile friendly UX
  5. WAI-ARIA compliant
  6. Support Asynchronous Google script loading

Installation

To install the stable version

npm install --save google-places-suggester

React component is exported as a default export

import AddressAutoComplete from "google-places-suggester";

utility functions are named exports

Getting Started

Create your component

import React from "react";
import PlacesAutocomplete from "google-places-suggester";

<AddressAutoComplete
  google_api_key={"YOUR_API_KEY"}
  allowedCountries={["Array of allowed country codes"]}
  seperatedAddress={true | false}
/>;

Props

PropTypeRequiredDescription
google_api_keystring:white_check_mark:The Google API key to be used to show suggestions.
allowedCountriesstring[]An array of country codes to allow. Use an empty array to allow all countries.
separatedAddressbooleanIf true, the address will be returned as an object containing address, postalCode, city, country, and state separately. If false, it will only return an object with the address.
onChangefunction:white_check_mark:Callback function to handle input changes.
labelstringLabel for the input field.
classNamestringCSS class name for styling.
stylesObjectCSS styles for customization.
onFocusfunctionCallback function when the input field is focused.
onBlurfunctionCallback function when the input field loses focus.
defaultValuestringDefault input value.
valuestringInput value.
refObjectReference object for accessing the input element.
disabledbooleanIf true, the input is disabled.
onPastefunctionCallback function for handling paste events.
requiredbooleanIf true, the input is required.
<AddressAutoComplete
  google_api_key={"YOUR_API_KEY"}
  allowedCountries={["Array of allowed country codes"]}
  seperatedAddress={true | false}
  onChange={(value) => this.setState({ value })}
/>
1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago