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

PropertyDefaultType/Description
ref-(marker: google.maps.Marker | null) => void
Provides a reference for the Marker instance.
anchorPoint-google.maps.Point
The offset from the marker's position to the tip of an InfoWindow that has been opened with the marker.
class-string
The class name of the Marker Content. Only applicable to HTML content.
clickabletrueboolean
Indicates whether the marker is clickable.
collisionBehaviornullgoogle.maps.CollisionBehavior
The behavior of the marker when it collides with another marker.
draggablefalseboolean
If true, the marker can be dragged.
position-google.maps.LatLngLiteral
The marker's position.
style-JSX.CSSProperties
The style of the Marker Content. Only applicable to HTML content.
title-string
The marker's title.
zIndex-number
The marker's zIndex.

Events

Event NameType/Description
onClickAdvancedMarkerMouseEvent
Fired when the marker is clicked.
onDragAdvancedMarkerMouseEvent
Fired repeatedly while the marker is being dragged.
onDragEndAdvancedMarkerMouseEvent
Fired when the marker stops being dragged.
onDragStartAdvancedMarkerMouseEvent
Fired when the marker starts being dragged.
onMouseLeaveAdvancedMarkerMouseEvent
Fired when the mouse leaves the marker.
onMouseEnterAdvancedMarkerMouseEvent
Fired when the mouse enters the marker.

Event Types

All Marker events extend the type MarkerEvent and have the following properties:

PropertyType/Description
typestring
The type of the event.
markergoogle.maps.AdvancedMarkerElement
The marker instance that the event was fired on.
stoppableboolean
Indicates whether the event is stoppable. If true, the event can be stopped from propagating further.
stop() => void
A function that stops the event from propagating further.
domEventMouseEvent | TouchEvent | PointerEvent | KeyboardEvent | Event
The 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
}