Map

Renders a reactive Google Map

API Reference

Props

PropertyDefaultType/Description
ref-(map: google.maps.Map | null) => void
A reference to the map instance.
id-string
An id for the map, this is required when multiple maps are present in the same APIProvider context.
style-JSX.CSSProperties
Additional style rules to apply to the map dom-element.
class-string
Additional css class-name to apply to the element containing the map.
colorScheme-'DARK' | 'LIGHT' | 'FOLLOW_SYSTEM'
The color-scheme to use for the map.
renderingType-'VECTOR' | 'RASTER' | 'UNINITIALIZED'
The rendering-type to be used.The rendering-type to be used.
controlledfalseboolean
Indicates that the map will be controlled externally. Disables all controls provided by the map itself.
reuseMapsfalseboolean
Enable caching of map-instances created by this component.
defaultCenter-{ lat: number; lng: number }
The default center point of the map. Required if center and defaultBounds are not provided.
defaultZoom-number
The default zoom of the map. Required if zoom and defaultBounds are not provided.
defaultHeading-number
The default heading of the map. Required if heading is not provided.
defaultTitle-number
The default tilt of the map. Required if tilt is not provided.
defaultBounds-{ lat: number; lng: number; padding: number | google.maps.Padding }
The default bounds of the map. If this is provided, no defaultCenter or defaultZoom are required.
backgroundColor-string
The background color of the map div. This color will be visible when tiles have not yet loaded as the user pans
center-{ lat: number; lng: number }
The center point of the map.
zoom-number
The zoom of the map.
heading-number
The heading of the map.
tilt-number
The tilt of the map.
clickableIconstrueboolean
If false, disables clickability of POI icons.
disableDefaultUIfalseboolean
If true, disables all default UI of the map.
disableDoubleClickZoomfalseboolean
If true, disables double click zoom on the map.
draggabletrueboolean
If false, prevents the map from being dragged.
draggableCursor-string
The name or url of the cursor to display when mousing over a draggable map.
draggingCursor-string
The name or url of the cursor to display when the map is being dragged.
fullscreenControlfalseboolean
The enabled state of the Fullscreen control.
fullscreenControlOptions-google.maps.FullscreenControlOptions
The options for the Fullscreen control.
gestureHandling-'cooperative' | 'greedy' | none' | 'auto'
The gesture handling behavior for the map.
headingInteractionEnabledfalseboolean
Whether the map should allow user control of the camera heading. The option is only in effect when the map is a vector map
isFractionalZoomEnabledtrue for vector maps and false for raster mapsboolean
Whether the map should allow fractional zoom levels.
keyboardShortcutstrueboolean
If false, prevents the map from being controlled by the keyboard.
mapId-string
The mapId to use for the map. Required for Cloud Maps and Advanced Markers. DEMO_MAP_ID can be used to try out features that require a map ID
mapTypeControl-boolean
The enabled state of the MapType control.
mapTypeControlOptions-google.maps.MapTypeControlOptions
The options for the MapType control.
mapTypeId'ROADMAP'google.maps.MapTypeId
The initial MapTypeId for the map.
maxZoom-number
The maximum zoom level of the map.
minZoom-number
The minimum zoom level of the map.
noClearfalseboolean
If true, the map will be rendered with no clear.
panControl-boolean
The enabled state of the Pan control.
panControlOptions-google.maps.PanControlOptions
The options for the Pan control.
renderingType'RASTER''VECTOR' | 'RASTER' | 'UNINITIALIZED'
The rendering-type to be used.
restriction-google.maps.MapRestriction
Defines a boundary that restricts the area of the map accessible to users. When set, a user can only pan and zoom while the camera view stays inside the limits of the boundary.
rotateControl-boolean
The enabled state of the Rotate control.
rotateControlOptions-google.maps.RotateControlOptions
The options for the Rotate control.
scaleControl-boolean
The enabled state of the Scale control.
scaleControlOptions-google.maps.ScaleControlOptions
The options for the Scale control.
scrollwheeltrueboolean
If false, disables scrollwheel zooming on the map.
streetView-google.maps.StreetViewPanorama
A StreetView Panorama to display when the Street View pegman is dropped on the map.
streetViewControl-boolean
The enabled state of the StreetView control.
streetViewControlOptions-google.maps.StreetViewControlOptions
The options for the StreetView control.
styles-google.maps.MapTypeStyle[]
Styles to apply to each of the default map types. For satellite, hybrid and terrain modes, these styles will only apply to labels and geometry. Not available when using a mapId or Vector Maps
tiltInteractionEnabledfalseboolean
Whether the map should allow user control of the camera tilt. The option is only in effect when the map is a vector map
zoomControl-boolean
The enabled state of the Zoom control.
zoomControlOptions-google.maps.ZoomControlOptions
The options for the Zoom control.

Events

Event NameType/Description
onBoundsChangedMapCameraChangedEvent
Fired when the bounds of the map have changed.
onCenterChangedMapCameraChangedEvent
Fired when the center of the map has changed.
onZoomChangedMapCameraChangedEvent
Fired when the zoom of the map has changed.
onHeadingChangedMapCameraChangedEvent
Fired when the heading of the map has changed.
onTiltChangedMapCameraChangedEvent
Fired when the tilt of the map has changed.
onCameraChangedMapCameraChangedEvent
Fired when the camera of the map has changed.
onClickMapMouseEvent
Fired when the map is clicked.
onDblClickMapMouseEvent
Fired when the map is double-clicked.
onContextMenuMapMouseEvent
Fired when the map is right-clicked.
onDragMapMouseEvent
Fired when the map is dragged.
onDragEndMapMouseEvent
Fired when the map is done being dragged.
onDragStartMapMouseEvent
Fired when the map is starting to be dragged.
onMousemoveMapMouseEvent
Fired when the mouse moves over the map.
onMouseoutMapMouseEvent
Fired when the mouse moves out of the map.
onMouseoverMapMouseEvent
Fired when the mouse moves over the map.
onTilesLoadedMapEvent
Fired when the visible tiles have finished loading.
onIdleMapEvent
Fired when the map becomes idle after panning.
onProjectionChangedMapEvent
Fired when the projection has changed.
onIsFractionalZoomEnabledChangedMapEvent
Fired when the fractional zoom setting has changed.
onMapTypeIdChangedMapEvent
Fired when the map type has changed.
onRenderingTypeChangedMapEvent
Fired when the rendering type has changed.

Event Types

All Map events extend the type MapEvent and have the following properties:

PropertyType/Description
typestring
The type of the event.
mapgoogle.maps.Map
The map instance that the event was fired on.
stoppableboolean
Indicates if the event is stoppable.
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.

MapMouseEvent

Contains a detail property with the latLng and placeId of the clicked location

{
  type: string
  map: google.maps.Map
  detail: {
    latLng: google.maps.LatLngLiteral | null;
    placeId: string | null;
  }
  stoppable: boolean
  stop: () => void
  domEvent?: MouseEvent | TouchEvent | PointerEvent | KeyboardEvent | Event
}

MapCameraChangedEvent

Contains a detail property with the position of the camera

{
  type: string
  map: google.maps.Map
  detail: {
    center: google.maps.LatLngLiteral
    bounds: google.maps.LatLngBoundsLiteral
    zoom: number
    heading: number
    tilt: number
  };
  stoppable: boolean
  stop: () => void
  domEvent?: MouseEvent | TouchEvent | PointerEvent | KeyboardEvent | Event
}