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 of the most common parameters:

Region

Using the optional `region` property doesn't strictly restrict results, but it strongly biases them towards the specified region. It influences address formatting and result ranking. This parameter should be a two-character CLDR region code (e.g., 'de' for Germany). If omitted, it may default to the user's IP address region.

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

Language

The optional `language` property specifies the language for the returned results. If a specific place doesn't have a translation, the result might be in a different language. If omitted, it defaults to the browser's language setting.

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

Primary Place Types

Use the `includedPrimaryTypes` property to filter results to specific place types, such as 'restaurant' or 'airport'. You can specify up to 5 types. If omitted, all types are returned. See the official Place Types documentation for a full list of supported types.

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

Region Codes

The `includedRegionCodes` property restricts results to a specific set of countries, specified as two-character CLDR codes. You can include up to 15 region codes. If you use this with `locationRestriction`, the results will be in the area of intersection.

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

Location Bias

The `locationBias` property biases results to a specific geographical area, making them more prominent without strictly limiting results to that area. If neither `locationBias` nor `locationRestriction` is set, results may be biased by the user's IP address. For the property definition, see the LocationBias documentation.

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

Location Restriction

The `locationRestriction` property strictly confines search results to a specific geographical area. Results outside this area will not be shown. For the property definition, see the LocationRestriction documentation.

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

2025 Places Autocomplete Svelte.