aritrakrbasu

payload google map autocomplete places

by aritrakrbasu
Custom fields
v2
^2.0.0
MIT

Overview

Summary generated from the README

Adds a Google Maps Places Autocomplete field to Payload collections through a helper function spread into the fields array. Editors search for an address and the plugin can auto-populate a latitude and longitude field. Requires a Google Maps API key and Payload 2.x.

Features

  • Places autocomplete field for the admin panel
  • Auto-populated latitude and longitude fields
  • Configurable country restrictions and search bounds
  • Debounce and minimum input length settings
  • Optional session tokens for Places billing
  • Language and region API options

Use cases

  • Let editors pick a business address and save its coordinates on a document
  • Restrict location search to specific countries for regional content

From the author

A Google Map Places Autocomplete Field for Payload CMS

Installation

npm i payload-google-autocomplete-places

28

Stars

4

Forks

2

Open Issues

2 months ago

Last Updated

44

Weekly Downloads

v1.0.3

npm Version

68.4 KB

Unpacked Size

3

Dependencies

GitHub stars

28+1 since Sep 6

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 202628
Dec 4, 202628
Dec 3, 202628
Dec 2, 202628
Dec 1, 202628
Nov 30, 202628
Nov 29, 202628
Nov 28, 202628
Nov 27, 202628
Nov 26, 202628
Nov 25, 202628
Nov 24, 202628
Nov 23, 202628
Nov 22, 202628
Nov 21, 202628
Nov 20, 202628
Nov 19, 202628
Nov 18, 202628
Nov 17, 202628
Nov 16, 202628
Nov 15, 202628
Nov 14, 202628
Nov 13, 202628
Nov 12, 202628
Nov 11, 202628
Nov 10, 202628
Nov 9, 202628
Nov 8, 202628
Nov 7, 202628
Nov 6, 202628
Nov 5, 202628
Nov 4, 202628
Nov 3, 202628
Nov 2, 202628
Nov 1, 202628
Oct 31, 202628
Oct 30, 202628
Oct 29, 202628
Oct 28, 202628
Oct 27, 202628
Oct 26, 202628
Oct 25, 202628
Oct 24, 202628
Oct 23, 202628
Oct 22, 202628
Oct 21, 202628
Oct 20, 202628
Oct 19, 202628
Oct 18, 202628
Oct 17, 202628
Oct 16, 202628
Oct 15, 202628
Oct 14, 202628
Oct 13, 202628
Oct 12, 202628
Oct 11, 202627
Oct 10, 202627
Oct 9, 202627
Oct 8, 202627
Oct 7, 202627
Oct 6, 202627
Oct 5, 202627
Oct 4, 202627
Oct 3, 202627
Oct 2, 202627
Oct 1, 202627
Sep 30, 202627
Sep 29, 202627
Sep 28, 202627
Sep 27, 202627
Sep 26, 202627
Sep 25, 202627
Sep 24, 202627
Sep 23, 202627
Sep 22, 202627
Sep 21, 202627
Sep 20, 202627
Sep 19, 202627
Sep 18, 202627
Sep 17, 202627
Sep 16, 202627
Sep 15, 202627
Sep 14, 202627
Sep 13, 202627
Sep 12, 202627
Sep 11, 202627
Sep 10, 202627
Sep 9, 202627
Sep 8, 202627
Sep 7, 202627
Sep 6, 202627
npm weekly downloads

36−36 since Sep 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 202636
Dec 4, 202615
Dec 3, 202616
Dec 2, 202618
Dec 1, 202616
Nov 30, 202617
Nov 29, 202627
Nov 28, 202624
Nov 27, 202624
Nov 26, 202622
Nov 25, 202619
Nov 24, 202619
Nov 23, 202618
Nov 22, 202611
Nov 21, 202629
Nov 20, 202631
Nov 19, 202632
Nov 18, 202641
Nov 17, 202641
Nov 16, 202643
Nov 15, 202640
Nov 14, 202625
Nov 13, 202623
Nov 12, 202635
Nov 11, 202625
Nov 10, 202629
Nov 9, 202627
Nov 8, 202628
Nov 7, 202625
Nov 6, 202625
Nov 5, 202618
Nov 4, 202623
Nov 3, 202618
Nov 2, 202617
Nov 1, 202615
Oct 31, 202617
Oct 30, 202620
Oct 29, 202613
Oct 28, 20268
Oct 27, 20268
Oct 26, 20269
Oct 25, 202611
Oct 24, 202611
Oct 23, 20266
Oct 22, 202634
Oct 21, 202668
Oct 20, 202692
Oct 19, 2026115
Oct 18, 2026139
Oct 17, 2026161
Oct 16, 2026185
Oct 15, 2026182
Oct 14, 2026174
Oct 13, 2026174
Oct 12, 2026174
Oct 11, 2026172
Oct 10, 2026172
Oct 9, 2026156
Oct 8, 2026135
Oct 7, 2026110
Oct 6, 202686
Oct 5, 202662
Oct 4, 202644
Oct 3, 202622
Oct 2, 202617
Oct 1, 202615
Sep 30, 202614
Sep 29, 202624
Sep 28, 202625
Sep 27, 202627
Sep 26, 202633
Sep 25, 202652
Sep 24, 202680
Sep 23, 2026105
Sep 22, 2026130
Sep 21, 2026155
Sep 20, 2026173
Sep 19, 2026191
Sep 18, 2026179
Sep 17, 2026170
Sep 16, 2026170
Sep 15, 2026159
Sep 14, 2026159
Sep 13, 2026159
Sep 12, 2026158
Sep 11, 2026175
Sep 10, 2026165
Sep 9, 2026143
Sep 8, 2026123
Sep 7, 202699
Sep 6, 202672

Each point is npm's rolling 7-day download count.

Health Score

55/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/795386489-root.svg)](https://payloaddirectory.dev/plugins/795386489-root)
HTML
<a href="https://payloaddirectory.dev/plugins/795386489-root"><img src="https://payloaddirectory.dev/badge/795386489-root.svg" alt="Payload Directory"></a>
Updated Sep 19, 2026Created May 3, 2024Published May 4, 2024

README

Google Maps Autocomplete plugin

Note This plugin is currently under active development and still in an early stage. Check the roadmap below in this readme for more details / upcoming features.

Shows an image illustrating the payload-google-autocomplete-places plugin

Installation

The most recent version of payload-google-autocomplete-places currently only supports Payload 2.0 and up.

$ yarn add payload-google-autocomplete-places
$ npm i payload-google-autocomplete-places

Basic usage

import { CollectionConfig } from "payload/types";
import { googleMapAutoCompletePlaces } from "payload-google-autocomplete-places";

const Examples: CollectionConfig = {
  slug: "examples",
  admin: {
    useAsTitle: "title",
  },
  fields: [
    {
      name: "title",
      type: "text",
    },
    ...googleMapAutoCompletePlaces({
      apiKey: "", //<google maps API Key Goes Here>
      name: "google_location",
      label: "Google Location",
    }),
  ],
};

Detailed usage (with all props)

import { CollectionConfig } from "payload/types";
import { googleMapAutoCompletePlaces } from "payload-google-autocomplete-places";

const Examples: CollectionConfig = {
  slug: "examples",
  admin: {
    useAsTitle: "title",
  },
  fields: [
    {
      name: "title",
      type: "text",
    },
    ...googleMapAutoCompletePlaces({
      apiKey: "", //<google maps API Key Goes Here>
      name: "google_location",
      label: "Google Location",
      required: true,
      minLengthAutocomplete: 3,
      autocompletionRequest: {
        bounds: [
          { lat: 50, lng: 50 },
          { lat: 100, lng: 100 },
        ],
        componentRestrictions: {
          country: ["us", "ca", "uy"],
        },
      }, //Note: for more information check google documentation(https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#AutocompletionRequest).

      debounce: 400,
      apiOptions: { language: "fr", region: "fr" }, //Note: for more information check google documentation(https://developers.google.com/maps/documentation/javascript/localization).
      withSessionToken: true, //If this prop is set to true, the component will handle changing the sessionToken on every session. To learn more about how this works refer to Google Places Session Token docs(https://developers.google.com/maps/documentation/places/web-service/session-tokens)
      admin: {
        description: "Please pick a location",
        disabled: false,
        hidden: false,
        position: "sidebar",
        readOnly: false,
        placeholder: "Please select a location",
      },
      access: {
        create: () => true,
        read: () => true,
        update: () => true,
      },
      latLng: {
        showFields: true,
        name: "latlng",
        label: "location coordinates",
        required: true,
        admin: {
          description: "Auto populated location coordinates",
          disabled: false,
          hidden: false,
          position: "sidebar",
        },
        access: {
          create: () => true,
          read: () => true,
          update: () => true,
        },
      },
    }),
  ],
};

Roadmap

Upcoming Features / Ideas. Have a suggestion for the plugin? Feel free to open an issue or contribute!
  • [] Payload 3.0 support
  • [] Adding Unit test for each component
  • [] Add Maps pointer preview

Similar plugins