BasicPlaceAutocompleteElement class
google.maps.places
. BasicPlaceAutocompleteElement
class
BasicPlaceAutocompleteElement is an HTMLElement
subclass which provides a UI component for the Places Autocomplete API.
Custom element: <gmp-basic-place-autocomplete included-primary-types="type1 type2 type3..." included-region-codes="c1 c2 c3..." name="string" origin="lat,lng" requested-language="string" requested-region="string" unit-system="metric"></gmp-basic-place-autocomplete>
This class extends HTMLElement
.
This class implements BasicPlaceAutocompleteElementOptions
.
Access by calling const {BasicPlaceAutocompleteElement} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constructor
BasicPlaceAutocompleteElement(options)
-
options
:BasicPlaceAutocompleteElementOptions
Properties
Array
<string> optional
A Place is only returned if its primary type is included in this list. Up to 5 values can be specified. If no types are specified, all Place types are returned.
-
<gmp-basic-place-autocomplete included-primary-types="type1 type2 type3..."></gmp-basic-place-autocomplete>
Array
<string> optional
locationRestriction
and includedRegionCodes
are set, the results will be located in the area of intersection.-
<gmp-basic-place-autocomplete included-region-codes="c1 c2 c3..."></gmp-basic-place-autocomplete>
LocationBias
optional
LocationRestriction
optional
string optional
-
<gmp-basic-place-autocomplete name="string"></gmp-basic-place-autocomplete>
LatLng
| LatLngLiteral
| LatLngAltitude
| LatLngAltitudeLiteral
optional
-
<gmp-basic-place-autocomplete origin="lat,lng"></gmp-basic-place-autocomplete>
-
<gmp-basic-place-autocomplete origin="lat,lng,altitude"></gmp-basic-place-autocomplete>
string optional
-
<gmp-basic-place-autocomplete requested-language="string"></gmp-basic-place-autocomplete>
string optional
.co.uk
) while its ISO 3166-1 code is "gb" (technically for the entity of "The United Kingdom of Great Britain and Northern Ireland").-
<gmp-basic-place-autocomplete requested-region="string"></gmp-basic-place-autocomplete>
UnitSystem
optional
-
<gmp-basic-place-autocomplete unit-system="metric"></gmp-basic-place-autocomplete>
-
<gmp-basic-place-autocomplete unit-system="imperial"></gmp-basic-place-autocomplete>
Slots |
|
---|---|
prediction-item-icon
|
This slot accepts exactly one
<template>
element to render as the icon shown next to the prediction item. |
Parts |
|
---|---|
prediction-item
|
An item in the drop down of predictions that represents a single prediction.
|
prediction-item-icon
|
The icon displayed to the left of each item in the list of predictions.
|
prediction-item-main-text
|
A part of prediction-item that is the main text of the prediction. For geographic locations, this contains a place name, like 'Sydney', or a street name and number, like '10 King Street'. By default, the prediction-item-main-text is colored black. If there is any additional text in the prediction-item, it is outside prediction-item-main-text and inherits its styling from prediction-item. It is colored gray by default. The additional text is typically an address.
|
prediction-item-match
|
The part of the returned prediction that matches the user’s input. By default, this matched text is highlighted in bold text. Note that the matched text may be anywhere within prediction-item. It is not necessarily part of prediction-item-main-text.
|
prediction-item-selected
|
The item when the user navigates to it via the keyboard. Note: Selected items will be affected by both this part styles and also the prediction-item part styles.
|
prediction-list
|
The visual element containing the list of predictions returned by the Place Autocomplete service. This list appears as a dropdown list below the PlaceAutocompleteElement.
|
CSS Properties |
|
---|---|
background-color
|
Overrides the background color of the element.
|
border
|
Overrides the border of the element.
|
border-radius
|
Overrides the border radius of the element.
|
color-scheme
|
Indicates which color scheme this element can be rendered in. See
color-scheme
documentation
for more details. Defaults to color-scheme: light dark
. |
Methods
addEventListener(type, listener[, options])
-
type
:string
A case-sensitive string representing the event type to listen for. -
listener
:EventListener | EventListenerObject
The object that receives a notification. This must be a function or an object with the handleEvent method -
options
:boolean| AddEventListenerOptions optional
See options . Custom events only supportcapture
andpassive
.
void
removeEventListener(type, listener[, options])
-
type
:string
A string which specifies the type of event for which to remove an event listener. -
listener
:EventListener | EventListenerObject
The event listener of the event handler to remove from the event target. -
options
:boolean| EventListenerOptions optional
See options .
void
Events
function(errorEvent)
-
errorEvent
:Event
function(placeSelectEvent)
-
placeSelectEvent
:PlaceSelectEvent
BasicPlaceAutocompleteElementOptions interface
google.maps.places
. BasicPlaceAutocompleteElementOptions
interface
Options for constructing a BasicPlaceAutocompleteElement.
Properties |
|
---|---|
includedPrimaryTypes
optional
|
Type:
Array
<string> optional
|
includedRegionCodes
optional
|
Type:
Array
<string> optional
|
locationBias
optional
|
Type:
LocationBias
optional
|
locationRestriction
optional
|
Type:
LocationRestriction
optional
|
name
optional
|
Type:
string optional
|
origin
optional
|
Type:
LatLng
| LatLngLiteral
| LatLngAltitude
| LatLngAltitudeLiteral
optional
|
requestedLanguage
optional
|
Type:
string optional
|
requestedRegion
optional
|
Type:
string optional
|
unitSystem
optional
|
Type:
UnitSystem
optional
|
PlaceAutocompleteElement class
google.maps.places
. PlaceAutocompleteElement
class
PlaceAutocompleteElement is an HTMLElement
subclass which provides a UI component for the Places Autocomplete API.
PlaceAutocompleteElement automatically uses AutocompleteSessionToken
s internally to group the query and selection phases of a user's autocomplete search.
The first call to Place.fetchFields
on a Place
returned by PlacePrediction.toPlace
will automatically include the session token used to fetch the PlacePrediction
.
See https://developers.google.com/maps/documentation/places/web-service/place-session-tokens
for more details on how sessions work.
Custom element: <gmp-place-autocomplete included-primary-types="type1 type2 type3..." included-region-codes="c1 c2 c3..." name="string" origin="lat,lng" requested-language="string" requested-region="string" unit-system="metric"></gmp-place-autocomplete>
This class extends HTMLElement
.
This class implements PlaceAutocompleteElementOptions
.
Access by calling const {PlaceAutocompleteElement} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constructor
PlaceAutocompleteElement(options)
-
options
:PlaceAutocompleteElementOptions
Properties
Array
<string> optional
A Place is only returned if its primary type is included in this list. Up to 5 values can be specified. If no types are specified, all Place types are returned.
-
<gmp-place-autocomplete included-primary-types="type1 type2 type3..."></gmp-place-autocomplete>
Array
<string> optional
locationRestriction
and includedRegionCodes
are set, the results will be located in the area of intersection.-
<gmp-place-autocomplete included-region-codes="c1 c2 c3..."></gmp-place-autocomplete>
LocationBias
optional
LocationRestriction
optional
string optional
-
<gmp-place-autocomplete name="string"></gmp-place-autocomplete>
LatLng
| LatLngLiteral
| LatLngAltitude
| LatLngAltitudeLiteral
optional
-
<gmp-place-autocomplete origin="lat,lng"></gmp-place-autocomplete>
-
<gmp-place-autocomplete origin="lat,lng,altitude"></gmp-place-autocomplete>
string optional
-
<gmp-place-autocomplete requested-language="string"></gmp-place-autocomplete>
string optional
.co.uk
) while its ISO 3166-1 code is "gb" (technically for the entity of "The United Kingdom of Great Britain and Northern Ireland").-
<gmp-place-autocomplete requested-region="string"></gmp-place-autocomplete>
UnitSystem
optional
-
<gmp-place-autocomplete unit-system="metric"></gmp-place-autocomplete>
-
<gmp-place-autocomplete unit-system="imperial"></gmp-place-autocomplete>
Parts |
|
---|---|
prediction-item
|
An item in the drop down of predictions that represents a single prediction.
|
prediction-item-icon
|
The icon displayed to the left of each item in the list of predictions.
|
prediction-item-main-text
|
A part of prediction-item that is the main text of the prediction. For geographic locations, this contains a place name, like 'Sydney', or a street name and number, like '10 King Street'. By default, the prediction-item-main-text is colored black. If there is any additional text in the prediction-item, it is outside prediction-item-main-text and inherits its styling from prediction-item. It is colored gray by default. The additional text is typically an address.
|
prediction-item-match
|
The part of the returned prediction that matches the user’s input. By default, this matched text is highlighted in bold text. Note that the matched text may be anywhere within prediction-item. It is not necessarily part of prediction-item-main-text.
|
prediction-item-selected
|
The item when the user navigates to it via the keyboard. Note: Selected items will be affected by both this part styles and also the prediction-item part styles.
|
prediction-list
|
The visual element containing the list of predictions returned by the Place Autocomplete service. This list appears as a dropdown list below the PlaceAutocompleteElement.
|
CSS Properties |
|
---|---|
background-color
|
Overrides the background color of the element.
|
border
|
Overrides the border of the element.
|
border-radius
|
Overrides the border radius of the element.
|
color-scheme
|
Indicates which color scheme this element can be rendered in. See
color-scheme
documentation
for more details. Defaults to color-scheme: light dark
. |
Methods
addEventListener(type, listener[, options])
-
type
:string
A case-sensitive string representing the event type to listen for. -
listener
:EventListener | EventListenerObject
The object that receives a notification. This must be a function or an object with the handleEvent method -
options
:boolean| AddEventListenerOptions optional
See options . Custom events only supportcapture
andpassive
.
void
removeEventListener(type, listener[, options])
-
type
:string
A string which specifies the type of event for which to remove an event listener. -
listener
:EventListener | EventListenerObject
The event listener of the event handler to remove from the event target. -
options
:boolean| EventListenerOptions optional
See options .
void
Events
function(errorEvent)
-
errorEvent
:Event
function(placePredictionSelectEvent)
-
placePredictionSelectEvent
:PlacePredictionSelectEvent
PlaceAutocompleteElementOptions interface
google.maps.places
. PlaceAutocompleteElementOptions
interface
Options for constructing a PlaceAutocompleteElement. For the description of each property, refer to the property of the same name in the PlaceAutocompleteElement class.
Properties |
|
---|---|
includedPrimaryTypes
optional
|
Type:
Array
<string> optional
|
includedRegionCodes
optional
|
Type:
Array
<string> optional
|
locationBias
optional
|
Type:
LocationBias
optional
|
locationRestriction
optional
|
Type:
LocationRestriction
optional
|
name
optional
|
Type:
string optional
|
origin
optional
|
Type:
LatLng
| LatLngLiteral
| LatLngAltitude
| LatLngAltitudeLiteral
optional
|
requestedLanguage
optional
|
Type:
string optional
|
requestedRegion
optional
|
Type:
string optional
|
unitSystem
optional
|
Type:
UnitSystem
optional
|
PlacePredictionSelectEvent class
google.maps.places
. PlacePredictionSelectEvent
class
This event is created after the user selects a prediction item with the PlaceAutocompleteElement. Access the selection with event.placePrediction
.
Convert placePrediction to a Place
by calling PlacePrediction.toPlace
.
This class extends Event
.
Access by calling const {PlacePredictionSelectEvent} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Properties |
|
---|---|
placePrediction
|
Type:
PlacePrediction
|
PlaceAutocompleteRequestErrorEvent class
google.maps.places
. PlaceAutocompleteRequestErrorEvent
class
This event is emitted by the PlaceAutocompleteElement when there is an issue with the network request.
This class extends Event
.
Access by calling const {PlaceAutocompleteRequestErrorEvent} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
PlaceContextualElement class
google.maps.places
. PlaceContextualElement
class
A widget that uses the context token to display a contextual view of the Grounding with Google Maps response.
Custom element: <gmp-place-contextual context-token="string"></gmp-place-contextual>
This class extends HTMLElement
.
This class implements PlaceContextualElementOptions
.
Access by calling const {PlaceContextualElement} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constructor
PlaceContextualElement([options])
-
options
:PlaceContextualElementOptions optional
Properties
string optional
-
<gmp-place-contextual context-token="string"></gmp-place-contextual>
Methods
addEventListener(type, listener[, options])
-
type
:string
A case-sensitive string representing the event type to listen for. -
listener
:EventListener | EventListenerObject
The object that receives a notification. This must be a function or an object with the handleEvent method -
options
:boolean| AddEventListenerOptions optional
See options . Custom events only supportcapture
andpassive
.
void
removeEventListener(type, listener[, options])
-
type
:string
A string which specifies the type of event for which to remove an event listener. -
listener
:EventListener | EventListenerObject
The event listener of the event handler to remove from the event target. -
options
:boolean| EventListenerOptions optional
See options .
void
PlaceContextualElementOptions interface
google.maps.places
. PlaceContextualElementOptions
interface
Options for PlaceContextualElement
.
Properties |
|
---|---|
contextToken
optional
|
Type:
string optional
The context token provided by the Grounding with Google Maps response.
|
PlaceContextualListConfigElement class
google.maps.places
. PlaceContextualListConfigElement
class
An HTML element that configures options for the Place Contextual Element's list view.
Custom element: <gmp-place-contextual-list-config layout="compact" map-hidden map-mode="none"></gmp-place-contextual-list-config>
This class extends HTMLElement
.
This class implements PlaceContextualListConfigElementOptions
.
Access by calling const {PlaceContextualListConfigElement} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constructor
PlaceContextualListConfigElement([options])
-
options
:PlaceContextualListConfigElementOptions optional
Properties
PlaceContextualListLayout
optional
-
<gmp-place-contextual-list-config layout="compact"></gmp-place-contextual-list-config>
-
<gmp-place-contextual-list-config layout="vertical"></gmp-place-contextual-list-config>
boolean optional
-
<gmp-place-contextual-list-config map-hidden></gmp-place-contextual-list-config>
PlaceContextualListMapMode
optional
-
<gmp-place-contextual-list-config map-mode="none"></gmp-place-contextual-list-config>
-
<gmp-place-contextual-list-config map-mode="roadmap"></gmp-place-contextual-list-config>
-
<gmp-place-contextual-list-config map-mode="hybrid"></gmp-place-contextual-list-config>
Methods
addEventListener(type, listener[, options])
-
type
:string
A case-sensitive string representing the event type to listen for. -
listener
:EventListener | EventListenerObject
The object that receives a notification. This must be a function or an object with the handleEvent method -
options
:boolean| AddEventListenerOptions optional
See options . Custom events only supportcapture
andpassive
.
void
removeEventListener(type, listener[, options])
-
type
:string
A string which specifies the type of event for which to remove an event listener. -
listener
:EventListener | EventListenerObject
The event listener of the event handler to remove from the event target. -
options
:boolean| EventListenerOptions optional
See options .
void
PlaceContextualListConfigElementOptions interface
google.maps.places
. PlaceContextualListConfigElementOptions
interface
Options for PlaceContextualListConfigElement.
Properties |
|
---|---|
layout
optional
|
Type:
PlaceContextualListLayout
optional
Default:
PlaceContextualListLayout.VERTICAL
The layout.
|
mapHidden
optional
|
Type:
boolean optional
Default:
false
True if the map should be hidden.
|
mapMode
optional
|
Type:
PlaceContextualListMapMode
optional
Default:
PlaceContextualListMapMode.ROADMAP
The map mode used in Place Contextual Element for a list of places.
|
PlaceContextualListLayout constants
google.maps.places
. PlaceContextualListLayout
constants
The list of layouts that the Place Contextual Element supports for the list view.
Access by calling const {PlaceContextualListLayout} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constants |
|
---|---|
COMPACT
|
Compact list layout: list items are rendered as links across a single line, with overflows in a dropdown list. |
VERTICAL
|
Vertical list layout: list items are rendered as cards in a vertical list. |
PlaceContextualListMapMode constants
google.maps.places
. PlaceContextualListMapMode
constants
The map mode used in Place Contextual Element for a list of places.
Access by calling const {PlaceContextualListMapMode} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constants |
|
---|---|
HYBRID
|
A transparent layer of major streets on satellite, or photorealistic imagery in 3D. |
NONE
|
No map. |
ROADMAP
|
A normal 2D street map. |
PlaceDetailsElement class
google.maps.places
. PlaceDetailsElement
class
Displays details for a place in a full layout. Append either a PlaceDetailsPlaceRequestElement
or PlaceDetailsLocationRequestElement
to specify the place to be rendered. Append a PlaceContentConfigElement
, PlaceStandardContentElement
, or PlaceAllContentElement
to specify which content to render.
Example:
<gmp-place-details>
<gmp-place-details-place-request
place=" PLACE_ID
"
></gmp-place-details-place-request>
<gmp-place-content-config>
<gmp-place-media lightbox-preferred></gmp-place-media>
</gmp-place-content-config>
</gmp-place-details>
To use this element, enable the Places UI Kit API for your project in the Google Cloud console.
Custom element: <gmp-place-details></gmp-place-details>
This class extends HTMLElement
.
This class implements PlaceDetailsElementOptions
.
Access by calling const {PlaceDetailsElement} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constructor
PlaceDetailsElement([options])
-
options
:PlaceDetailsElementOptions optional
Properties |
|
---|---|
place
|
Type:
Place
optional
Read only. Place object containing the ID, location, and viewport of the currently rendered place.
|
CSS Properties |
|
---|---|
--gmp-button-border-color
|
Border color of the "Open in Maps" button.
|
--gmp-button-border-radius
|
Border radius of the "Open in Maps" button.
|
--gmp-button-border-width
|
Border width of the "Open in Maps" button.
|
--gmp-collage-border-radius-outer
|
Border radius of the outer corners of the media collage.
|
--gmp-dialog-border-radius
|
Border radius of the Google Maps disclosure dialog.
|
--gmp-mat-color-disabled-surface
|
Surface color intended to convey disabled states or non-presence. Used for empty review stars.
|
--gmp-mat-color-info
|
Color of UI elements with informational sentiment. Used for the wheelchair icon.
|
--gmp-mat-color-negative
|
Color of UI elements with negative sentiment. Used for "Closed" text in open now status.
|
--gmp-mat-color-neutral-container
|
Container color for neutral filled UI elements. Used for image placeholders and review published date badge.
|
--gmp-mat-color-on-neutral-container
|
Color of text and icons against the neutral container color. Used for the review published date badge and EV charger availability badge when unavailable.
|
--gmp-mat-color-on-positive-container
|
Color of texts and icons against the positive container color. Used for the EV charger availability badge when available.
|
--gmp-mat-color-on-secondary-container
|
Color of text and icons against the secondary container color. Used for text and icons on the "Open in Maps" button.
|
--gmp-mat-color-on-surface
|
Color for text and icons against any surface color. Used for regular text.
|
--gmp-mat-color-on-surface-variant
|
Lower-emphasis color for text and icons against any surface color. Used for less emphasized text.
|
--gmp-mat-color-outline-decorative
|
Outline color of non-interactive elements. Used for the element's border.
|
--gmp-mat-color-positive
|
Color of UI elements with positive sentiment. Used for "Open" text in open now status.
|
--gmp-mat-color-positive-container
|
Container color for UI elements that convey positive sentiment. Used for the EV charger availability badge when available.
|
--gmp-mat-color-primary
|
Color of interactive text and icons against the surface color. Used for review count, links in the Google Maps disclosures dialog, website link, icons in the overview tab, and (hover / focus / text color) on tab bar titles.
|
--gmp-mat-color-secondary-container
|
Less prominent fill color against surface, for recessive components like tonal buttons. Used for the background of the "Open in Maps" button.
|
--gmp-mat-color-surface
|
Color for backgrounds. Used for the backgrounds of the element and the Google Maps disclosures dialog.
|
--gmp-mat-font-body-medium
|
Used for the place address, rating, type, price, open now status, opening hours, review, phone number, website, plus code, top features, and body text in the Google Maps disclosures dialog.
|
--gmp-mat-font-body-small
|
Used for body text in the features list in the 'About' tab.
|
--gmp-mat-font-display-small
|
Used for the place name and the text for each feature heading in the 'About' tab.
|
--gmp-mat-font-family
|
Base font family used for all text.
|
--gmp-mat-font-headline-medium
|
Used for heading text in the Google Maps disclosures dialog.
|
--gmp-mat-font-label-large
|
Used for the tab titles, the "Open in Maps" button, reviewer attribution text in the photo gallery, reviewer attribution text in the reviews section, and links in the Google Maps disclosures dialog.
|
--gmp-mat-font-label-medium
|
Used for the photos count badge and the review published date bage.
|
--gmp-mat-font-title-small
|
Used for the title of each section in the 'About' tab.
|
--gmp-mat-spacing-extra-large
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-mat-spacing-extra-small
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-mat-spacing-large
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-mat-spacing-medium
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-mat-spacing-small
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-mat-spacing-two-extra-large
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-star-rating-color
|
Color of the filled stars in the rating.
|
background-color
|
Overrides the background color of the element.
|
border
|
Overrides the border of the element.
|
border-radius
|
Overrides the border radius of the element.
|
color-scheme
|
Indicates which color scheme this element can be rendered in. See
color-scheme
documentation
for more details. Defaults to color-scheme: light dark
. |
font-size
|
Scales all text and icons in the element, which are defined internally in ems. Defaults to
16px
. |
Methods
addEventListener(type, listener[, options])
-
type
:string
A case-sensitive string representing the event type to listen for. -
listener
:EventListener | EventListenerObject
The object that receives a notification. This must be a function or an object with the handleEvent method -
options
:boolean| AddEventListenerOptions optional
See options . Custom events only supportcapture
andpassive
.
void
removeEventListener(type, listener[, options])
-
type
:string
A string which specifies the type of event for which to remove an event listener. -
listener
:EventListener | EventListenerObject
The event listener of the event handler to remove from the event target. -
options
:boolean| EventListenerOptions optional
See options .
void
Events
function(event)
-
event
:Event
PlaceDetailsElementOptions interface
google.maps.places
. PlaceDetailsElementOptions
interface
Options for PlaceDetailsElement
.
PlaceDetailsCompactElement class
google.maps.places
. PlaceDetailsCompactElement
class
Displays details for a place in a compact layout. Append a PlaceDetailsPlaceRequestElement
or PlaceDetailsLocationRequestElement
to specify the place to be rendered. Append a PlaceContentConfigElement
, PlaceStandardContentElement
, or PlaceAllContentElement
to specify which content to render.
Example:
<gmp-place-details-compact>
<gmp-place-details-place-request
place=" PLACE_ID
"
></gmp-place-details-place-request>
<gmp-place-content-config>
<gmp-place-media lightbox-preferred></gmp-place-media>
</gmp-place-content-config>
</gmp-place-details-compact>
To use this element, enable the Places UI Kit API for your project in the Google Cloud console.
Custom element: <gmp-place-details-compact orientation="vertical" truncation-preferred></gmp-place-details-compact>
This class extends HTMLElement
.
This class implements PlaceDetailsCompactElementOptions
.
Access by calling const {PlaceDetailsCompactElement} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constructor
PlaceDetailsCompactElement([options])
-
options
:PlaceDetailsCompactElementOptions optional
Properties
PlaceDetailsOrientation
optional
PlaceDetailsOrientation.VERTICAL
-
<gmp-place-details-compact orientation="vertical"></gmp-place-details-compact>
-
<gmp-place-details-compact orientation="horizontal"></gmp-place-details-compact>
Place
optional
boolean
false
-
<gmp-place-details-compact truncation-preferred></gmp-place-details-compact>
CSS Properties |
|
---|---|
--gmp-button-border-color
|
Border color of the "Open in Maps" button.
|
--gmp-button-border-radius
|
Border radius of the "Open in Maps" button.
|
--gmp-button-border-width
|
Border width of the "Open in Maps" button.
|
--gmp-dialog-border-radius
|
Border radius of the Google Maps disclosure dialog.
|
--gmp-mat-color-info
|
Color of UI elements with informational sentiment. Used for the wheelchair icon.
|
--gmp-mat-color-negative
|
Color of UI elements with negative sentiment. Used for "Closed" text in open now status.
|
--gmp-mat-color-neutral-container
|
Container color for neutral filled UI elements. Used for image placeholders.
|
--gmp-mat-color-on-secondary-container
|
Color of text and icons against the secondary container color. Used for text and icons on the "Open in Maps" button.
|
--gmp-mat-color-on-surface
|
Color for text and icons against any surface color. Used for regular text.
|
--gmp-mat-color-on-surface-variant
|
Lower-emphasis color for text and icons against any surface color. Used for less emphasized text.
|
--gmp-mat-color-outline-decorative
|
Outline color of non-interactive elements. Used for the element's border.
|
--gmp-mat-color-positive
|
Color of UI elements with positive sentiment. Used for "Open" text in open now status.
|
--gmp-mat-color-primary
|
Color of interactive text and icons against the surface color. Used for review count, as well as links in the Google Maps disclosures dialog.
|
--gmp-mat-color-secondary-container
|
Less prominent fill color against surface, for recessive components like tonal buttons. Used for the background of the "Open in Maps" button.
|
--gmp-mat-color-surface
|
Color for backgrounds. Used for the backgrounds of the element and the Google Maps disclosures dialog.
|
--gmp-mat-font-body-medium
|
Used for body text in the Google Maps disclosures dialog.
|
--gmp-mat-font-body-small
|
Used for the place address, rating, type, price, and open now status.
|
--gmp-mat-font-family
|
Base font family used for all text.
|
--gmp-mat-font-headline-medium
|
Used for heading text in the Google Maps disclosures dialog.
|
--gmp-mat-font-label-large
|
Used for the "Open in Maps" button as well as links in the Google Maps disclosures dialog and reviewer attribution text in the photo gallery.
|
--gmp-mat-font-label-medium
|
Used for the photos count badge.
|
--gmp-mat-font-title-small
|
Used for the place name.
|
--gmp-mat-spacing-extra-small
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-mat-spacing-large
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-mat-spacing-medium
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-mat-spacing-small
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-star-rating-color
|
Color of the filled stars in the rating.
|
--gmp-thumbnail-border-radius
|
Border radius of the place thumbnail image.
|
background-color
|
Overrides the background color of the element.
|
border
|
Overrides the border of the element.
|
border-radius
|
Overrides the border radius of the element.
|
color-scheme
|
Indicates which color scheme this element can be rendered in. See
color-scheme
documentation
for more details. Defaults to color-scheme: light dark
. |
font-size
|
Scales all text and icons in the element, which are defined internally in ems. Defaults to
16px
. |
Methods
addEventListener(type, listener[, options])
-
type
:string
A case-sensitive string representing the event type to listen for. -
listener
:EventListener | EventListenerObject
The object that receives a notification. This must be a function or an object with the handleEvent method -
options
:boolean| AddEventListenerOptions optional
See options . Custom events only supportcapture
andpassive
.
void
removeEventListener(type, listener[, options])
-
type
:string
A string which specifies the type of event for which to remove an event listener. -
listener
:EventListener | EventListenerObject
The event listener of the event handler to remove from the event target. -
options
:boolean| EventListenerOptions optional
See options .
void
Events
function(event)
-
event
:Event
PlaceDetailsCompactElementOptions interface
google.maps.places
. PlaceDetailsCompactElementOptions
interface
Options for PlaceDetailsCompactElement
.
Properties |
|
---|---|
orientation
optional
|
Type:
PlaceDetailsOrientation
optional
|
truncationPreferred
optional
|
Type:
boolean optional
|
PlaceDetailsOrientation constants
google.maps.places
. PlaceDetailsOrientation
constants
Orientation variants for PlaceDetailsCompactElement
.
Access by calling const {PlaceDetailsOrientation} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constants |
|
---|---|
HORIZONTAL
|
Horizontal orientation. |
VERTICAL
|
Vertical orientation. |
PlaceDetailsPlaceRequestElement class
google.maps.places
. PlaceDetailsPlaceRequestElement
class
Configures a PlaceDetailsCompactElement
or PlaceDetailsElement
to load data based on a place object, ID, or resource name. Append this element as a child of a PlaceDetailsCompactElement
or PlaceDetailsElement
to load data for the specified place. For example:
<gmp-place-details>
<gmp-place-details-place-request
place=" PLACE_ID
"
></gmp-place-details-place-request>
</gmp-place-details>
Custom element: <gmp-place-details-place-request place="some-place-id"></gmp-place-details-place-request>
This class extends HTMLElement
.
This class implements PlaceDetailsPlaceRequestElementOptions
.
Access by calling const {PlaceDetailsPlaceRequestElement} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constructor
PlaceDetailsPlaceRequestElement([options])
-
options
:PlaceDetailsPlaceRequestElementOptions optional
Properties
Place
optional
null
-
<gmp-place-details-place-request place="some-place-id"></gmp-place-details-place-request>
Methods
addEventListener(type, listener[, options])
-
type
:string
A case-sensitive string representing the event type to listen for. -
listener
:EventListener | EventListenerObject
The object that receives a notification. This must be a function or an object with the handleEvent method -
options
:boolean| AddEventListenerOptions optional
See options . Custom events only supportcapture
andpassive
.
void
removeEventListener(type, listener[, options])
-
type
:string
A string which specifies the type of event for which to remove an event listener. -
listener
:EventListener | EventListenerObject
The event listener of the event handler to remove from the event target. -
options
:boolean| EventListenerOptions optional
See options .
void
PlaceDetailsPlaceRequestElementOptions interface
google.maps.places
. PlaceDetailsPlaceRequestElementOptions
interface
Options for PlaceDetailsPlaceRequestElement
.
Properties |
|
---|---|
place
optional
|
Type:
Place
|string optional
|
PlaceDetailsLocationRequestElement class
google.maps.places
. PlaceDetailsLocationRequestElement
class
Configures a PlaceDetailsCompactElement
or PlaceDetailsElement
to load data based on a location. Append this element as a child of a PlaceDetailsCompactElement
or PlaceDetailsElement
to load data for the specified location. For example:
<gmp-place-details>
<gmp-place-details-location-request
location="37.6207665,-122.4284806"
></gmp-place-details-location-request>
</gmp-place-details>
Custom element: <gmp-place-details-location-request location="lat,lng"></gmp-place-details-location-request>
This class extends HTMLElement
.
This class implements PlaceDetailsLocationRequestElementOptions
.
Access by calling const {PlaceDetailsLocationRequestElement} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constructor
PlaceDetailsLocationRequestElement([options])
-
options
:PlaceDetailsLocationRequestElementOptions optional
Properties
LatLng
| LatLngLiteral
| LatLngAltitude
| LatLngAltitudeLiteral
optional
null
LatLngAltitude
.-
<gmp-place-details-location-request location="lat,lng"></gmp-place-details-location-request>
Methods
addEventListener(type, listener[, options])
-
type
:string
A case-sensitive string representing the event type to listen for. -
listener
:EventListener | EventListenerObject
The object that receives a notification. This must be a function or an object with the handleEvent method -
options
:boolean| AddEventListenerOptions optional
See options . Custom events only supportcapture
andpassive
.
void
removeEventListener(type, listener[, options])
-
type
:string
A string which specifies the type of event for which to remove an event listener. -
listener
:EventListener | EventListenerObject
The event listener of the event handler to remove from the event target. -
options
:boolean| EventListenerOptions optional
See options .
void
PlaceDetailsLocationRequestElementOptions interface
google.maps.places
. PlaceDetailsLocationRequestElementOptions
interface
Options for PlaceDetailsLocationRequestElement
.
Properties |
|
---|---|
location
optional
|
Type:
LatLng
| LatLngLiteral
| LatLngAltitude
| LatLngAltitudeLiteral
optional
The location to render the place for.
|
PlaceSearchElement class
google.maps.places
. PlaceSearchElement
class
Displays the results of a place search in a list. Append a PlaceTextSearchRequestElement
or PlaceNearbySearchRequestElement
to specify the request to render results for. Append a PlaceContentConfigElement
, PlaceStandardContentElement
, or PlaceAllContentElement
to specify which content to render.
Example:
<gmp-place-search>
<gmp-place-text-search-request
text-query=" QUERY
"
></gmp-place-text-search-request>
<gmp-place-content-config>
<gmp-place-media lightbox-preferred></gmp-place-media>
</gmp-place-content-config>
</gmp-place-search>
To use the Place Search Element, enable the Places UI Kit API for your project in the Google Cloud console.
Custom element: <gmp-place-search attribution-position="top" orientation="vertical" selectable truncation-preferred></gmp-place-search>
This class extends HTMLElement
.
This class implements PlaceSearchElementOptions
.
Access by calling const {PlaceSearchElement} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constructor
PlaceSearchElement([options])
-
options
:PlaceSearchElementOptions optional
Properties
PlaceSearchAttributionPosition
optional
PlaceSearchAttributionPosition.TOP
-
<gmp-place-search attribution-position="top"></gmp-place-search>
-
<gmp-place-search attribution-position="bottom"></gmp-place-search>
PlaceSearchOrientation
optional
PlaceSearchOrientation.VERTICAL
-
<gmp-place-search orientation="vertical"></gmp-place-search>
-
<gmp-place-search orientation="horizontal"></gmp-place-search>
boolean optional
false
gmp-select
event when clicked. Accessible keyboard navigation and selection is also supported.-
<gmp-place-search selectable></gmp-place-search>
boolean optional
false
-
<gmp-place-search truncation-preferred></gmp-place-search>
CSS Properties |
|
---|---|
--gmp-button-border-color
|
Border color for "Open in Maps" button.
|
--gmp-button-border-radius
|
Border radius for "Open in Maps" button.
|
--gmp-button-border-width
|
Border width for "Open in Maps" button.
|
--gmp-card-border-radius
|
Border radius for place cards.
|
--gmp-dialog-border-radius
|
Border radius for the Google Maps disclosure dialog.
|
--gmp-mat-color-info
|
Color of UI elements with informational sentiment. Used for the accessible entrance icon.
|
--gmp-mat-color-negative
|
Color of UI elements with negative sentiment. Used for the "Closed" label for a place's opening hours.
|
--gmp-mat-color-neutral-container
|
Container color for neutral filled UI elements. Used for review date badges and loading placeholder shapes.
|
--gmp-mat-color-on-neutral-container
|
Color of text and icons on a neutral container. Used for review date text and loading error text.
|
--gmp-mat-color-on-secondary-container
|
Color of text and icons against a secondary container color. Used for button text and icons.
|
--gmp-mat-color-on-surface
|
Color for text and icons against a surface color. Used for headings and dialog content.
|
--gmp-mat-color-on-surface-variant
|
Lower-emphasis color for text and icons against a surface color. Used for place information.
|
--gmp-mat-color-outline-decorative
|
Outline color of non-interactive elements. Used for the container border.
|
--gmp-mat-color-positive
|
Color of UI elements with positive sentiment. Used for the "Open" label for a place's opening hours.
|
--gmp-mat-color-primary
|
Color of interactive text and icons against the surface color. Used for links, loading indicator, and overview icons.
|
--gmp-mat-color-secondary-container
|
Less prominent fill color against a surface. Used for button backgrounds.
|
--gmp-mat-color-surface
|
Color for backgrounds. Used for container and dialog backgrounds.
|
--gmp-mat-font-body-small
|
Used for place information.
|
--gmp-mat-font-family
|
Base font family for all text.
|
--gmp-mat-font-headline-medium
|
Used for dialog headings.
|
--gmp-mat-font-label-large
|
Used for button content.
|
--gmp-mat-font-title-medium
|
Used for the place name.
|
--gmp-mat-spacing-extra-small
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-mat-spacing-large
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-mat-spacing-medium
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-mat-spacing-small
|
Used for spacing within the element, such as the margin and padding around text.
|
--gmp-star-rating-color
|
Color of filled stars in a star rating.
|
--gmp-thumbnail-border-radius
|
Border radius for the place thumbnail image.
|
background-color
|
Overrides the background color of the element.
|
border
|
Overrides the border of the element.
|
border-radius
|
Overrides the border radius of the element.
|
color-scheme
|
Indicates which color scheme this element can be rendered in. See
color-scheme
documentation
for more details. Defaults to color-scheme: light dark
. |
font-size
|
Scales all text and icons in the element. Defaults to
16px
. |
Methods
addEventListener(type, listener[, options])
-
type
:string
A case-sensitive string representing the event type to listen for. -
listener
:EventListener | EventListenerObject
The object that receives a notification. This must be a function or an object with the handleEvent method -
options
:boolean| AddEventListenerOptions optional
See options . Custom events only supportcapture
andpassive
.
void
removeEventListener(type, listener[, options])
-
type
:string
A string which specifies the type of event for which to remove an event listener. -
listener
:EventListener | EventListenerObject
The event listener of the event handler to remove from the event target. -
options
:boolean| EventListenerOptions optional
See options .
void
Events
function(event)
-
event
:Event
function(event)
-
event
:Event
function(event)
-
event
:PlaceSelectEvent
Place
object containing the ID, location, and viewport of the selected place.PlaceSearchElementOptions interface
google.maps.places
. PlaceSearchElementOptions
interface
Options for PlaceSearchElement
.
Properties |
|
---|---|
attributionPosition
optional
|
Type:
PlaceSearchAttributionPosition
optional
|
orientation
optional
|
Type:
PlaceSearchOrientation
optional
|
selectable
optional
|
Type:
boolean optional
|
truncationPreferred
optional
|
Type:
boolean optional
|
PlaceSearchAttributionPosition constants
google.maps.places
. PlaceSearchAttributionPosition
constants
Attribution positions for PlaceSearchElement
.
Access by calling const {PlaceSearchAttributionPosition} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constants |
|
---|---|
BOTTOM
|
Attribution at the bottom of the PlaceSearchElement |
TOP
|
Attribution at the top of the PlaceSearchElement |
PlaceSearchOrientation constants
google.maps.places
. PlaceSearchOrientation
constants
Orientation variants for PlaceSearchElement
.
Access by calling const {PlaceSearchOrientation} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constants |
|
---|---|
HORIZONTAL
|
Horizontal orientation. |
VERTICAL
|
Vertical orientation. |
PlaceSelectEvent class
google.maps.places
. PlaceSelectEvent
class
This event fires when a place is selected from a list of places. Access the selection with event.place
.
This class extends Event
.
Access by calling const {PlaceSelectEvent} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Properties |
|
---|---|
place
|
Type:
Place
The selected place.
|
PlaceNearbySearchRequestElement class
google.maps.places
. PlaceNearbySearchRequestElement
class
Configures a PlaceSearchElement
to load results based on a nearby search request. The locationRestriction
property is required for the search element to load. Any other configured properties will be ignored if locationRestriction
is not set. Append this element as a child of a PlaceSearchElement
to load results. For example:
<gmp-place-search>
<gmp-place-nearby-search-request
location-restriction=" RADIUS
@ LAT
, LNG
"
></gmp-place-nearby-search-request>
<gmp-place-content-config>
<gmp-place-media lightbox-preferred></gmp-place-media>
</gmp-place-content-config>
</gmp-place-search>
Custom element: <gmp-place-nearby-search-request excluded-primary-types="excluded-primary-type1 excluded-primary-type2..." excluded-types="excluded-type1 excluded-type2..." included-primary-types="included-primary-type1 included-primary-type2..." included-types="included-type1 included-type2..." location-restriction="radius@lat,lng" max-result-count="number" rank-preference="preference"></gmp-place-nearby-search-request>
This class extends HTMLElement
.
This class implements PlaceNearbySearchRequestElementOptions
.
Access by calling const {PlaceNearbySearchRequestElement} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constructor
PlaceNearbySearchRequestElement([options])
-
options
:PlaceNearbySearchRequestElementOptions optional
Properties
Array
<string> optional
null
-
<gmp-place-nearby-search-request excluded-primary-types="excluded-primary-type1 excluded-primary-type2..."></gmp-place-nearby-search-request>
Array
<string> optional
null
-
<gmp-place-nearby-search-request excluded-types="excluded-type1 excluded-type2..."></gmp-place-nearby-search-request>
Array
<string> optional
null
-
<gmp-place-nearby-search-request included-primary-types="included-primary-type1 included-primary-type2..."></gmp-place-nearby-search-request>
Array
<string> optional
null
-
<gmp-place-nearby-search-request included-types="included-type1 included-type2..."></gmp-place-nearby-search-request>
Circle
| CircleLiteral
optional
null
-
<gmp-place-nearby-search-request location-restriction="radius@lat,lng"></gmp-place-nearby-search-request>
number optional
null
-
<gmp-place-nearby-search-request max-result-count="number"></gmp-place-nearby-search-request>
SearchNearbyRankPreference
optional
null
-
<gmp-place-nearby-search-request rank-preference="preference"></gmp-place-nearby-search-request>
Methods
addEventListener(type, listener[, options])
-
type
:string
A case-sensitive string representing the event type to listen for. -
listener
:EventListener | EventListenerObject
The object that receives a notification. This must be a function or an object with the handleEvent method -
options
:boolean| AddEventListenerOptions optional
See options . Custom events only supportcapture
andpassive
.
void
removeEventListener(type, listener[, options])
-
type
:string
A string which specifies the type of event for which to remove an event listener. -
listener
:EventListener | EventListenerObject
The event listener of the event handler to remove from the event target. -
options
:boolean| EventListenerOptions optional
See options .
void
PlaceNearbySearchRequestElementOptions interface
google.maps.places
. PlaceNearbySearchRequestElementOptions
interface
Options for PlaceNearbySearchRequestElement
.
PlaceTextSearchRequestElement class
google.maps.places
. PlaceTextSearchRequestElement
class
Configures a PlaceSearchElement
to load results based on a text search request. The textQuery
property is required for the search element to load. Any other configured properties will be ignored if textQuery
is not set. Append this element as a child of a PlaceSearchElement
to load results. For example:
<gmp-place-search>
<gmp-place-text-search-request
text-query=" QUERY
"
></gmp-place-text-search-request>
<gmp-place-content-config>
<gmp-place-media lightbox-preferred></gmp-place-media>
</gmp-place-content-config>
</gmp-place-search>
Custom element: <gmp-place-text-search-request ev-connector-types="ev-connector-type1 ev-connector-type2..." ev-minimum-charging-rate-kw="rate" included-type="type" is-open-now="true" location-bias="lat,lng" location-restriction="swlat,swlng|nelat,nelng" max-result-count="number" min-rating="number" price-levels="price-level1 price-level2..." rank-preference="preference" text-query="string" use-strict-type-filtering></gmp-place-text-search-request>
This class extends HTMLElement
.
This class implements PlaceTextSearchRequestElementOptions
.
Access by calling const {PlaceTextSearchRequestElement} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constructor
PlaceTextSearchRequestElement([options])
-
options
:PlaceTextSearchRequestElementOptions optional
Properties
Array
< EVConnectorType
> optional
null
-
<gmp-place-text-search-request ev-connector-types="ev-connector-type1 ev-connector-type2..."></gmp-place-text-search-request>
number optional
null
-
<gmp-place-text-search-request ev-minimum-charging-rate-kw="rate"></gmp-place-text-search-request>
string optional
null
-
<gmp-place-text-search-request included-type="type"></gmp-place-text-search-request>
boolean optional
null
-
<gmp-place-text-search-request is-open-now="true"></gmp-place-text-search-request>
string| LatLngAltitude
| LatLngBounds
| Circle
| LatLng
| LatLngLiteral
| LatLngAltitudeLiteral
| LatLngBoundsLiteral
| CircleLiteral
optional
null
-
<gmp-place-text-search-request location-bias="lat,lng"></gmp-place-text-search-request>
-
<gmp-place-text-search-request location-bias="lat,lng[,altitude]"></gmp-place-text-search-request>
-
<gmp-place-text-search-request location-bias="swlat,swlng|nelat,nelng"></gmp-place-text-search-request>
-
<gmp-place-text-search-request location-bias="radius@lat,lng"></gmp-place-text-search-request>
-
<gmp-place-text-search-request location-bias="IP_BIAS"></gmp-place-text-search-request>
LatLngBounds
| LatLngBoundsLiteral
optional
null
-
<gmp-place-text-search-request location-restriction="swlat,swlng|nelat,nelng"></gmp-place-text-search-request>
number optional
null
-
<gmp-place-text-search-request max-result-count="number"></gmp-place-text-search-request>
number optional
null
-
<gmp-place-text-search-request min-rating="number"></gmp-place-text-search-request>
Array
< PriceLevel
> optional
null
-
<gmp-place-text-search-request price-levels="price-level1 price-level2..."></gmp-place-text-search-request>
SearchByTextRankPreference
optional
null
-
<gmp-place-text-search-request rank-preference="preference"></gmp-place-text-search-request>
string optional
null
-
<gmp-place-text-search-request text-query="string"></gmp-place-text-search-request>
boolean optional
null
-
<gmp-place-text-search-request use-strict-type-filtering></gmp-place-text-search-request>
Methods
addEventListener(type, listener[, options])
-
type
:string
A case-sensitive string representing the event type to listen for. -
listener
:EventListener | EventListenerObject
The object that receives a notification. This must be a function or an object with the handleEvent method -
options
:boolean| AddEventListenerOptions optional
See options . Custom events only supportcapture
andpassive
.
void
removeEventListener(type, listener[, options])
-
type
:string
A string which specifies the type of event for which to remove an event listener. -
listener
:EventListener | EventListenerObject
The event listener of the event handler to remove from the event target. -
options
:boolean| EventListenerOptions optional
See options .
void
PlaceTextSearchRequestElementOptions interface
google.maps.places
. PlaceTextSearchRequestElementOptions
interface
Options for PlaceTextSearchRequestElement
.
Autocomplete class
google.maps.places
. Autocomplete
class
A widget that provides Place predictions based on a user's text input. It attaches to an input element of type text
, and listens for text entry in that field. The list of predictions is presented as a drop-down list, and is updated as text is entered.
This class extends MVCObject
.
Access by calling const {Autocomplete} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constructor
Autocomplete(inputField[, opts])
-
inputField
:HTMLInputElement
The<input>
text field to which theAutocomplete
should be attached. -
opts
:AutocompleteOptions optional
Options.
Autocomplete
that attaches to the specified input text field with the given options.Methods
getBounds()
LatLngBounds
|undefined
The biasing bounds.getFields()
Array
<string>|undefined
PlaceResult
.getPlace()
PlaceResult
The Place selected by the user.name
property set to the current value of the input field.setBounds(bounds)
-
bounds
:LatLngBounds | LatLngBoundsLiteral optional
The biasing bounds.
setComponentRestrictions(restrictions)
-
restrictions
:ComponentRestrictions optional
The restrictions to use.
setFields(fields)
-
fields
:Array <string> optional
PlaceResult
.setTypes(types)
-
types
:Array <string> optional
The types of predictions to be included.
Events |
|
---|---|
place_changed
|
function()
Arguments: None
This event is fired when a
PlaceResult
is made available for a Place the user has selected.If the user enters the name of a Place that was not suggested by the control and presses the Enter key, or if a Place Details request fails, the PlaceResult
contains the user input in the name
property, with no other properties defined. |
AutocompleteOptions interface
google.maps.places
. AutocompleteOptions
interface
The options that can be set on an Autocomplete
object.
Properties |
|
---|---|
bounds
optional
|
Type:
LatLngBounds
| LatLngBoundsLiteral
optional
The area in which to search for places.
|
componentRestrictions
optional
|
Type:
ComponentRestrictions
optional
The component restrictions. Component restrictions are used to restrict predictions to only those within the parent component. For example, the country.
|
fields
optional
|
Type:
Array
<string> optional
Fields to be included for the Place in the details response when the details are successfully retrieved, which will be billed for
. If
['ALL']
is passed in, all available fields will be returned and billed for (this is not recommended for production deployments). For a list of fields see PlaceResult
. Nested fields can be specified with dot-paths (for example, "geometry.location"
). The default is ['ALL']
. |
|
Type:
boolean optional
Whether to retrieve only Place IDs. The PlaceResult made available when the place_changed event is fired will only have the place_id, types and name fields, with the place_id, types and description returned by the Autocomplete service. Disabled by default.
|
strictBounds
optional
|
Type:
boolean optional
A boolean value, indicating that the Autocomplete widget should only return those places that are inside the bounds of the Autocomplete widget at the time the query is sent. Setting strictBounds to
false
(which is the default) will make the results biased towards, but not restricted to, places contained within the bounds. |
types
optional
|
Type:
Array
<string> optional
The types of predictions to be returned. For supported types, see the developer's guide
. If no types are specified, all types will be returned.
|
SearchBox class
google.maps.places
. SearchBox
class
A widget that provides query predictions based on a user's text input. It attaches to an input element of type text
, and listens for text entry in that field. The list of predictions is presented as a drop-down list, and is updated as text is entered.
This class extends MVCObject
.
Access by calling const {SearchBox} = await google.maps.importLibrary("places")
.See Libraries in the Maps JavaScript API
.
Constructor
SearchBox(inputField[, opts])
-
inputField
:HTMLInputElement
-
opts
:SearchBoxOptions optional
SearchBox
that attaches to the specified input text field with the given options.Methods
getBounds()
LatLngBounds
|undefined
getPlaces()
Array
< PlaceResult
>|undefined
places_changed
event.setBounds(bounds)
-
bounds
:LatLngBounds | LatLngBoundsLiteral optional
Events |
|
---|---|
places_changed
|
function()
Arguments: None
This event is fired when the user selects a query,
getPlaces
should be used to get new places. |
SearchBoxOptions interface
google.maps.places
. SearchBoxOptions
interface
The options that can be set on a SearchBox
object.
Properties |
|
---|---|
bounds
optional
|
Type:
LatLngBounds
| LatLngBoundsLiteral
optional
The area towards which to bias query predictions. Predictions are biased towards, but not restricted to, queries targeting these bounds.
|