---
title: "<ScriptGoogleMapsMarker> · Nuxt Scripts"
description: "Add a reactive advanced marker with optional custom Vue content."
canonical_url: "https://scripts.nuxt.com/scripts/google-maps/api/marker"
meta:
  "og:description": "Add a reactive advanced marker with optional custom Vue content."
  "og:image": "https://scripts.nuxt.com/_og/s/o_b3286bdd00745eb7.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "<ScriptGoogleMapsMarker> · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/s/o_b3286bdd00745eb7.png"
---

> Index of every page on this site: [llms.txt](https://scripts.nuxt.com/llms.txt)

**Api**

# **\<ScriptGoogleMapsMarker>**

[Copy for LLMs](https://scripts.nuxt.com/scripts/google-maps/api/marker.md)

Map marker with HTML content support. Place inside a [`**<ScriptGoogleMaps>**`](https://scripts.nuxt.com/scripts/google-maps/api/script-google-maps) component.

This component uses Google's [`**AdvancedMarkerElement**`](https://developers.google.com/maps/documentation/javascript/advanced-markers/start), which requires a map ID. Nuxt Scripts falls back to Google's `**DEMO_MAP_ID**`, but Google reserves that ID for testing; pass your own `**mapId**` in production.

`**position**``google.maps.LatLngLiteral | google.maps.LatLng`

The position of the marker on the map.

`**options**``Omit<google.maps.marker.AdvancedMarkerElementOptions, 'map'>`

Configuration options for the marker.

## Usage

```vue
<template>
  <ScriptGoogleMaps api-key="your-api-key">
    <ScriptGoogleMapsMarker
      :position="{ lat: -34.407, lng: 150.654 }"
    />
  </ScriptGoogleMaps>
</template>
```

### Custom Marker Content

The `**#content**` slot replaces the default pin with any HTML or Vue content. The slot content becomes the marker's visual on the map.

```vue
<template>
  <ScriptGoogleMaps api-key="your-api-key">
    <ScriptGoogleMapsMarker
      :position="{ lat: -34.397, lng: 150.644 }"
    >
      <template #content>
        <div class="bg-green-600 text-white px-2.5 py-1 rounded-full font-bold">
          $420k
        </div>
      </template>
    </ScriptGoogleMapsMarker>
  </ScriptGoogleMaps>
</template>
```

### Draggable Marker

Enable dragging with `**gmpDraggable**` in the `**options**` prop. Listen to drag events to track position changes.

```vue
<script setup lang="ts">
function onDragEnd(e: google.maps.MapMouseEvent) {
  console.log('New position:', e.latLng?.toJSON())
}
</script>

<template>
  <ScriptGoogleMaps api-key="your-api-key">
    <ScriptGoogleMapsMarker
      :position="{ lat: -34.397, lng: 150.644 }"
      :options="{ gmpDraggable: true }"
      @dragend="onDragEnd"
    />
  </ScriptGoogleMaps>
</template>
```

### Click Events

The marker is clickable by default. Use `**@click**` to handle interactions.

```vue
<script setup lang="ts">
const selected = ref<string | null>(null)
const locations = [
  { id: 'sydney', name: 'Sydney', position: { lat: -33.8688, lng: 151.2093 } },
  { id: 'melbourne', name: 'Melbourne', position: { lat: -37.8136, lng: 144.9631 } },
]
</script>

<template>
  <ScriptGoogleMaps
    api-key="your-api-key"
    :map-options="{
      center: { lat: -35.5, lng: 148 },
      zoom: 5,
    }"
  >
    <ScriptGoogleMapsMarker
      v-for="loc in locations"
      :key="loc.id"
      :position="loc.position"
      @click="selected = loc.id"
    >
      <ScriptGoogleMapsInfoWindow v-if="selected === loc.id">
        <div>{{ loc.name }}</div>
      </ScriptGoogleMapsInfoWindow>
    </ScriptGoogleMapsMarker>
  </ScriptGoogleMaps>
</template>
```

### With Custom Overlay

```vue
<template>
  <ScriptGoogleMaps api-key="your-api-key">
    <ScriptGoogleMapsMarker
      :position="{ lat: -34.397, lng: 150.644 }"
      :options="{ gmpDraggable: true }"
    >
      <ScriptGoogleMapsOverlayView
        anchor="bottom-center"
        :offset="{ x: 0, y: -50 }"
      >
        <div class="custom-tooltip">
          Custom Vue content
        </div>
      </ScriptGoogleMapsOverlayView>
    </ScriptGoogleMapsMarker>
  </ScriptGoogleMaps>
</template>
```

### Clusterer Integration

When placed inside a [`**<ScriptGoogleMapsMarkerClusterer>**`](https://scripts.nuxt.com/scripts/google-maps/api/marker-clusterer), the clusterer automatically registers markers. No extra configuration needed.

```vue
<template>
  <ScriptGoogleMaps api-key="your-api-key">
    <ScriptGoogleMapsMarkerClusterer>
      <ScriptGoogleMapsMarker
        v-for="loc in locations"
        :key="loc.id"
        :position="loc.position"
      />
    </ScriptGoogleMapsMarkerClusterer>
  </ScriptGoogleMaps>
</template>
```

Both `**position**` and `**options**` are reactive. The component forces `**gmpClickable: true**` and forwards the `**gmp-click**` DOM event. At runtime the click payload is Google's `**AdvancedMarkerClickEvent**`, although the current Vue emit type incorrectly declares `**MapMouseEvent**`.

[Edit this page](https://github.com/nuxt/scripts/edit/main/docs/content/google-maps/2.api/2.marker.md)

[Markdown For LLMs](https://scripts.nuxt.com/scripts/google-maps/api/marker.md)

[**\<ScriptGoogleMapsStaticMap>** Render a Google Maps Static API image directly from Google.](https://scripts.nuxt.com/scripts/google-maps/api/static-map) [**\<ScriptGoogleMapsInfoWindow>** Show an information window anchored to a marker or map position.](https://scripts.nuxt.com/scripts/google-maps/api/info-window)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scripts.nuxt.com/#website","@type":"WebSite","description":"Nuxt Scripts lets you load third-party scripts with better performance, privacy, security and DX. It includes many popular third-parties out of the box.","name":"Nuxt Scripts","url":"https://scripts.nuxt.com/","publisher":{"@id":"https://scripts.nuxt.com/#identity"}},{"@id":"https://scripts.nuxt.com/scripts/google-maps/api/marker#webpage","@type":"WebPage","description":"Add a reactive advanced marker with optional custom Vue content.","name":"<ScriptGoogleMapsMarker>","url":"https://scripts.nuxt.com/scripts/google-maps/api/marker","breadcrumb":{"@id":"https://scripts.nuxt.com/scripts/google-maps/api/marker#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/scripts/google-maps/api/marker"]}],"primaryImageOfPage":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/#identity","@type":"Organization","name":"Nuxt Scripts","url":"https://scripts.nuxt.com","logo":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/scripts/google-maps/api/marker#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Nuxt Scripts","item":"https://scripts.nuxt.com/","position":1},{"@type":"ListItem","name":"Scripts","item":"https://scripts.nuxt.com/scripts","position":2},{"@type":"ListItem","name":"Google Maps","item":"https://scripts.nuxt.com/scripts/google-maps","position":3},{"@type":"ListItem","name":"API","item":"https://scripts.nuxt.com/scripts/google-maps/api","position":4},{"@type":"ListItem","name":"<ScriptGoogleMapsMarker>","item":"https://scripts.nuxt.com/scripts/google-maps/api/marker","position":5}]},{"@id":"https://scripts.nuxt.com/#logo","@type":"ImageObject","caption":"Nuxt Scripts","contentUrl":"https://scripts.nuxt.com/logo.svg","inLanguage":"en","url":"https://scripts.nuxt.com/logo.svg"}]}
```

## Sitemap

See the full [sitemap](https://scripts.nuxt.com/sitemap.md) for all pages.
