Location Input

The Location Input component uses the Google API to add the Google Maps utility into any client-side application. You need a GoogleAPI key to work with the Location Input component. This key must be passed to the MapsContext.Provider component, which should wrap any Location component rendering.

MapsContext.Provider also supports customizing the map for a specific country or region by passing local language and region codes. If you set the language of the map, it's important to set the region to ensure that your application complies with local laws. By default, the map uses the user's preferred language setting as specified in the browser and region, defaulting to the region assigned to the user’s browser timezone offset.

Note: For security reasons, the following demo features a development version of the Google Maps API that does not require an API key. Add protection to your API key by following the Google API key restriction guidelines.

The Location Input is an input field that is powered by Google's auto-complete. You can capture a user's selection from the input by providing an onSelect function that collects the address, latitude, longitude, and name of the chosen location.

LocationInput provides a current location Button. This button allows a user to quickly geolocalize their current location. Location Inputs that do not use the Location Map component must support having the “Powered by Google” graphic within the list of selection results, as per Google’s guidelines.