Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google-address-autocomplete

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-address-autocomplete

This is a package that gives an input address autocomplete by using Google's lookup.

  • 1.0.2
  • npm
  • Socket score

Version published
Weekly downloads
200
increased by27.39%
Maintainers
1
Weekly downloads
 
Created
Source

Google Address Autocomplete

A library that attaches Google address autocomplete to a text input.

Dependencies

  • Google Places Library

Installation

npm install google-address-autocomplete

Usage

Once you have it installed, you can then use it in your JS files like so:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <label for="my-input-id-or-class-name">Enter the first address here</label>
  <!-- Here we are giving our input and ID so we can tell autocomplete where to work -->
  <input type="text" id="my-input-id-or-class-name" name="my-input-id-or-class-name" />

  <!-- This is the one external dependency that is needed in order to make this package work -->
  <script src="https://maps.googleapis.com/maps/api/js?key=YOU_GOOGLE_API_KEY_GOES_HERE&libraries=places"></script>
  <script src="js/your-compiled-script-here.js"></script>
</body>
</html>
import AddressAutocomplete from 'google-address-autocomplete';

// Use a callback here to get the results
new AddressAutocomplete('#my-input-id-or-class-name', results => {
  const addressObject = results;

  // This is what the results object looks like
  results = {
    cityName: "Birmingham",
    country: "United States",
    countryAbbr: "US",
    formattedAddress: "123 Shades Crest Rd, Birmingham, AL 35226, USA",
    state: "Alabama",
    stateAbbr: "AL",
    streetName: "Shades Crest Road",
    streetNumber: "123",
    zipCode: "35226",
  };
});

Contributing

See the contributing guide

Issues

If you find an issue, submit it and let's fix it!

Keywords

FAQs

Package last updated on 05 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc