Skip to main content

Other Vue 3 components

Start with GmvMap, then add only the Google Maps features your screen needs. This page gives you the practical role of each component before you jump into dedicated guides or API details.

Component overview

ComponentUse it whenNext step
GmvMarkerYou need an Advanced Marker point on the map that can react to clicks, drag, join clusters, or anchor an info window.Read the Marker guide.
GmvInfoWindowYou need contextual content anchored to a marker or position.Read the InfoWindow guide.
GmvAutocompleteYou need a Places-powered search input.Read the Autocomplete guide.
GmvCircleYou need a radius around a point.Read the Circle guide.
GmvPolygonYou need a filled area with one or more paths.Read the Polygon guide.
GmvPolylineYou need a path without a filled area.Read the Polyline guide.
GmvRectangleYou need a rectangular bounds overlay.Read the Rectangle guide.
GmvKmlLayerYou need to render a KML source supported by Google Maps.Read the KML Layer guide.
GmvHeatmapLayerYou need density visualization over a set of weighted points.Read the Heatmap Layer guide.
GmvClusterYou need to group many markers visually.Read the Cluster guide.
GmvStreetViewPanoramaYou need an embedded standalone Street View panorama.Read the Street View Panorama guide.
GmvDrawingManagerYou maintain an app that still depends on the old Drawing Library.Read the Drawing Manager legacy guide.

Optional Google Maps library preloading

Some components use optional Google Maps libraries. The wrappers import those libraries internally, but you can still list them in your loader configuration when you want to make dependencies explicit or preload them.

main.ts
createGmapVuePlugin({
load: {
key: import.meta.env.VITE_GOOGLE_MAPS_API_KEY,
libraries: "places,visualization",
},
});
FeatureLibrary
GmvAutocompleteplaces
GmvHeatmapLayervisualization
GmvDrawingManagerdrawing, only for legacy environments where Google still serves the removed Drawing Library

GmvMarker imports the Google Maps marker library internally. GmvInfoWindow, GmvKmlLayer, and the shape components (GmvCircle, GmvPolygon, GmvPolyline, and GmvRectangle) import the Google Maps maps library internally. GmvHeatmapLayer imports the Google Maps visualization library internally. GmvStreetViewPanorama imports the Google Maps streetView library internally. GmvCluster uses the package dependency @googlemaps/markerclusterer.

Access component instances

Use composables when you need the underlying Google Maps object after a component is mounted.

MarkerExample.vue
<script setup lang="ts">
import { useMapPromise, useMarkerPromise } from "@gmap-vue/v3/composables";

const mapKey = "main-map";
const markerKey = "office-marker";
const mapPromise = useMapPromise(mapKey);
const markerPromise = useMarkerPromise(markerKey);

async function focusMarker() {
const [map, marker] = await Promise.all([mapPromise, markerPromise]);
if (!map || !marker?.position) return;

map.panTo(marker.position);
}
</script>

<template>
<GmvMap
:map-key="mapKey"
:center="{ lat: 47.3763, lng: 8.5475 }"
:zoom="13"
style="width: 100%; height: 500px"
>
<GmvMarker
:marker-key="markerKey"
:position="{ lat: 47.3763, lng: 8.5475 }"
title="Office"
/>
</GmvMap>

<button @click="focusMarker">Focus marker</button>
</template>

Prefer component props and events for normal Vue state updates. Reach for use*Promise only when you need a Google Maps instance method that is not represented as a Vue prop or event yet.

Next steps