Pick location

Open the platform's map picker

Opens the platform's native geolocation map picker (search, current-location detection, marker drag, reverse-geocoding) in a modal over the custom form/component. It runs in the parent window, which owns the Google Maps API key.

Parameter

ParameterTypeDescription
valueObjectOptional current geolocation value to pre-select on the map.

The value object accepts the following properties:

PropertyTypeDescription
LatitudeStringThe latitude of the location.
LongitudeStringThe longitude of the location.
AddressStringThe formatted address (optional).
City, State, Country, ZipCode, AreaStringAdditional address parts (optional).

Syntax

kf.client.pickLocation(value).then((location) => {...})

or

const location = await kf.client.pickLocation(value);

Returns

Returns a promise that resolves with the picked location object, or null if the picker is closed without a selection.

Example

To let the client pick a location and pass it to the field's change handler.

const location = await kf.client.pickLocation();
if (location) onChange(location);

Output

{
  Address: "MG Road, Bengaluru, Karnataka 560001, India",
  Latitude: "12.9757",
  Longitude: "77.6060",
  City: "Bengaluru",
  State: "Karnataka",
  Country: "India",
  ZipCode: "560001"
}

On this page