Advanced Marker
Renders an Advanced Marker
Advanced Marker can be given HTML content as a child. If no children are provided, the marker will be rendered as a simple marker.
API Reference
Props
| Property | Default | Type/Description |
|---|---|---|
ref | - | (marker: google.maps.Marker | null) => voidProvides a reference for the Marker instance. |
anchorPoint | - | google.maps.PointThe offset from the marker's position to the tip of an InfoWindow that has been opened with the marker. |
class | - | stringThe class name of the Marker Content. Only applicable to HTML content. |
clickable | true | booleanIndicates whether the marker is clickable. |
collisionBehavior | null | google.maps.CollisionBehaviorThe behavior of the marker when it collides with another marker. |
draggable | false | booleanIf true, the marker can be dragged. |
position | - | google.maps.LatLngLiteralThe marker's position. |
style | - | JSX.CSSPropertiesThe style of the Marker Content. Only applicable to HTML content. |
title | - | stringThe marker's title. |
zIndex | - | numberThe marker's zIndex. |
Events
| Event Name | Type/Description |
|---|---|
onClick | AdvancedMarkerMouseEventFired when the marker is clicked. |
onDrag | AdvancedMarkerMouseEventFired repeatedly while the marker is being dragged. |
onDragEnd | AdvancedMarkerMouseEventFired when the marker stops being dragged. |
onDragStart | AdvancedMarkerMouseEventFired when the marker starts being dragged. |
onMouseLeave | AdvancedMarkerMouseEventFired when the mouse leaves the marker. |
onMouseEnter | AdvancedMarkerMouseEventFired when the mouse enters the marker. |
Event Types
All Marker events extend the type MarkerEvent and have the following properties:
| Property | Type/Description |
|---|---|
type | stringThe type of the event. |
marker | google.maps.AdvancedMarkerElementThe marker instance that the event was fired on. |
stoppable | booleanIndicates whether the event is stoppable. If true, the event can be stopped from propagating further. |
stop | () => voidA function that stops the event from propagating further. |
domEvent | MouseEvent | TouchEvent | PointerEvent | KeyboardEvent | EventThe original DOM event that triggered the map event. |
AdvancedMarkerMouseEvent
Contains a detail property with the latLng of the clicked Marker
{
type: string
marker: google.maps.AdvancedMarkerElement
latLng: google.maps.LatLngLiteral | null
stoppable: boolean
stop: () => void
domEvent?: MouseEvent
}