<ScriptGoogleMapsOverlayView>
Renders arbitrary Vue slot content at a map lat/lng position. Unlike InfoWindow, you have full control over HTML structure and styling.
positiongoogle.maps.LatLngLiteralanchorOverlayAnchoroffset{ x: number, y: number }paneOverlayPanezIndexnumberblockMapInteractionbooleanv-model:openbooleanMarker Anchoring
When nested inside a ScriptGoogleMapsMarker or ScriptGoogleMapsAdvancedMarkerElement, the overlay automatically inherits the marker's position. This makes it a fully customizable alternative to InfoWindow, the overlay follows the marker when dragged.
<template>
<ScriptGoogleMaps api-key="your-api-key">
<ScriptGoogleMapsAdvancedMarkerElement
:position="{ lat: -34.397, lng: 150.644 }"
:options="{ gmpDraggable: true }"
>
<ScriptGoogleMapsOverlayView
anchor="bottom-center"
:offset="{ x: 0, y: -50 }"
>
<div class="custom-tooltip">
Fully custom content, no InfoWindow constraints
</div>
</ScriptGoogleMapsOverlayView>
</ScriptGoogleMapsAdvancedMarkerElement>
</ScriptGoogleMaps>
</template>
Popup on Marker Click
Using v-model:open keeps the overlay mounted, toggling visibility via CSS. This avoids remount cost and preserves internal state.
<script setup lang="ts">
const open = ref(false)
</script>
<template>
<ScriptGoogleMaps api-key="your-api-key">
<ScriptGoogleMapsAdvancedMarkerElement
:position="{ lat: -34.397, lng: 150.644 }"
@click="open = !open"
>
<ScriptGoogleMapsOverlayView
v-model:open="open"
anchor="bottom-center"
:offset="{ x: 0, y: -50 }"
>
<div class="custom-popup">
<button @click.stop="open = false">
×
</button>
<p>Any Vue content here</p>
</div>
</ScriptGoogleMapsOverlayView>
</ScriptGoogleMapsAdvancedMarkerElement>
</ScriptGoogleMaps>
</template>
For simple cases where remounting is acceptable, v-if also works:
<ScriptGoogleMapsAdvancedMarkerElement
:position="{ lat: -34.397, lng: 150.644 }"
@click="open = true"
>
<ScriptGoogleMapsOverlayView v-if="open">
<MyPopup @close="open = false" />
</ScriptGoogleMapsOverlayView>
</ScriptGoogleMapsAdvancedMarkerElement>
Persistent Label
<template>
<ScriptGoogleMaps api-key="your-api-key">
<ScriptGoogleMapsOverlayView
:position="{ lat: -34.397, lng: 150.644 }"
anchor="center"
:block-map-interaction="false"
>
<span style="background: white; padding: 2px 6px; border-radius: 4px;">
Label text
</span>
</ScriptGoogleMapsOverlayView>
</ScriptGoogleMaps>
</template>
blockMapInteraction prop (default true) calls google.maps.OverlayView.preventMapHitsAndGesturesFrom() to stop clicks, taps, and drags from propagating through the overlay to the map. Set it to false for non-interactive overlays like labels.<ScriptGoogleMapsHeatmapLayer>
Heatmap visualization layer. Place inside a <ScriptGoogleMaps> component. The component automatically loads the visualization library.
useScriptGoogleMaps()
The useScriptGoogleMaps() composable lets you have fine-grained control over the Google Maps SDK. It provides a way to load the Google Maps SDK and interact with it programmatically.