Request parameters

The optional `requestParams` property allows you to fine-tune the autocomplete search by passing additional parameters to the underlying Google Maps Places Autocomplete API. The `requestParams` prop accepts an object that corresponds to the AutocompleteRequest object in the Google Maps API documentation.

<script> 
...
/**
* @type object optional
* AutocompleteRequest properties
*/
const requestParams = {
/**
* @type string optional
*/
region : 'GB',

/**
* @type string optional
*/
language : 'en-GB',      
}
</script>

<PlaceAutocomplete  
{onResponse} 
{onError} 
{requestParams} 
{PUBLIC_GOOGLE_MAPS_API_KEY} />

<p>Response Object: {JSON.stringify(fullResponse, null, 2)}</p>

...

Here are some common use cases and examples:

Region

Using the optional`region` does not restrict results to the specified region. Instead it affects address formating, result ranking and may influence what results are returned. This parameter specified as a CLDR two-character region code. If ommited, defaults to `GB`.

const requestParams = {
/**
* @type string optional
*/
region : 'GB',  
}

Language

The optional `language` property sets in which languate ro return results. The results may be in mixed languages if the input language is different `language` property or returned Place does not have translation from the local language. If ommited, defaults to `en-GB`.

const requestParams = {
/**
* @type string optional
*/
language : 'en-GB',
}

Primary Place Types

The optional `includedPrimaryTypes` property sets to return Places included in the list. Up to 5 values can be specified. If ommited, all Place types are returned. For the primary Place types see Place Types in the Google Maps API documentation.

const requestParams = {
/**
* @type array optional
*/
includedPrimaryTypes : ['restaurant', 'bar', 'cafe'],
}

Region Codes

The optional `includedRegionCodes` property sets to return results in the specified regions. Up to 15 two-character region codes can be specified. If ommited, no result restrictions are applied. If both `includedRegionCodes` and `includedRegionCodes` are set, the results will be located in the area of intersection.

const requestParams = {
/**
* @type array optional
*/
includedRegionCodes : ['GB', 'DE', 'IT'],
}

Location Bias

The optional `locationBias` property sets results to a specific location. If neither of`locationBias` and `locationRestriction` are set, the results will be biased by IP address. For property defenition see LocationBias in the Google Maps API documentation.

const requestParams = {
	/**
	* @type object optional
	*/
	locationBias : {
		"lat":53.30133845118124,
		"lng":-1.8017578125
	},
}

Location Restriction

The optional `locationRestriction` property sets results to a specific location. If neither of`locationBias` and `locationRestriction` are set, the results will be biased by IP address. For property defenition see LocationRestriction in the Google Maps API documentation.

const requestParams = {
	/**
	* @type object optional
	*/
	locationRestriction:{
		"north":54.09994059671522,
		"east":-0.7812994437747967,
		"south":52.844531447174056,
		"west":-3.6816900687747967
	}
}

2025 Places Autocomplete Svelte.