---
title: "Example: Markers & Info Windows · Nuxt Scripts"
description: "Add advanced markers, info windows, and custom HTML popups to a Google map."
canonical_url: "https://scripts.nuxt.com/scripts/google-maps/guides/markers-and-info-windows"
meta:
  "og:description": "Add advanced markers, info windows, and custom HTML popups to a Google map."
  "og:image": "https://scripts.nuxt.com/_og/s/o_5b5f09539d9e8f38.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Example: Markers & Info Windows · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/s/o_5b5f09539d9e8f38.png"
---

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

**Guides**

# **Example: Markers & Info Windows**

[Copy for LLMs](https://scripts.nuxt.com/scripts/google-maps/guides/markers-and-info-windows.md)

**Markers & Info Windows Demo**

Click the red pin or green pin for an info window. Click the price tag for a custom popup.

These examples build on Google's [**advanced markers**](https://developers.google.com/maps/documentation/javascript/advanced-markers/overview) and [**info windows**](https://developers.google.com/maps/documentation/javascript/infowindows). Follow those guides when you need options beyond the component props shown here.

## Simple Markers

```vue
<template>
  <ScriptGoogleMaps
    :map-options="{
      center: { lat: -33.8688, lng: 151.2093 },
      zoom: 13,
    }"
  >
    <ScriptGoogleMapsMarker
      :position="{ lat: -33.8568, lng: 151.2153 }"
    />
    <ScriptGoogleMapsMarker
      :position="{ lat: -33.8688, lng: 151.2093 }"
    />
  </ScriptGoogleMaps>
</template>
```

## Colored Pins

Use the `**#content**` slot to customize the pin appearance.

```vue
<template>
  <ScriptGoogleMaps
    :map-options="{
      center: { lat: -33.8688, lng: 151.2093 },
      zoom: 13,
    }"
  >
    <ScriptGoogleMapsMarker :position="{ lat: -33.8568, lng: 151.2153 }">
      <template #content>
        <div class="w-7 h-7 rounded-full border-2 bg-[#FF0000] border-[#CC0000]" />
      </template>
    </ScriptGoogleMapsMarker>
    <ScriptGoogleMapsMarker :position="{ lat: -33.8688, lng: 151.2093 }">
      <template #content>
        <div class="w-6 h-6 rounded-full border-2 bg-[#4285F4] border-[#1a73e8]" />
      </template>
    </ScriptGoogleMapsMarker>
  </ScriptGoogleMaps>
</template>
```

## Custom HTML Markers

The `**#content**` slot replaces the default pin with any Vue template. Useful for price labels, avatars, or status indicators.

```vue
<template>
  <ScriptGoogleMaps
    :map-options="{
      center: { lat: -33.8688, lng: 151.2093 },
      zoom: 13,
    }"
  >
    <ScriptGoogleMapsMarker
      v-for="listing in listings"
      :key="listing.id"
      :position="listing.position"
    >
      <template #content>
        <div class="bg-blue-600 text-white px-2.5 py-1 rounded-full font-bold text-sm whitespace-nowrap">
          {{ listing.price }}
        </div>
      </template>
    </ScriptGoogleMapsMarker>
  </ScriptGoogleMaps>
</template>
```

## Info Windows

`**ScriptGoogleMapsInfoWindow**` opens automatically when the parent marker is clicked.

```vue
<template>
  <ScriptGoogleMaps
    :map-options="{
      center: { lat: -33.8688, lng: 151.2093 },
      zoom: 13,
    }"
  >
    <ScriptGoogleMapsMarker :position="{ lat: -33.8568, lng: 151.2153 }">
      <ScriptGoogleMapsInfoWindow>
        <h3>Sydney Opera House</h3>
        <p>Iconic performing arts venue on Sydney Harbour.</p>
      </ScriptGoogleMapsInfoWindow>
    </ScriptGoogleMapsMarker>
  </ScriptGoogleMaps>
</template>
```

## Custom Popups with OverlayView

`**ScriptGoogleMapsOverlayView**` gives full control over popup HTML and styling, unlike `**InfoWindow**` which constrains your markup.

Use `**v-model:open**` to toggle visibility without remounting the component.

```vue
<script setup lang="ts">
const showPopup = ref(false)
</script>

<template>
  <ScriptGoogleMaps
    :map-options="{
      center: { lat: -33.8688, lng: 151.2093 },
      zoom: 13,
    }"
  >
    <ScriptGoogleMapsMarker
      :position="{ lat: -33.8688, lng: 151.2093 }"
      @click="showPopup = !showPopup"
    >
      <ScriptGoogleMapsOverlayView
        v-model:open="showPopup"
        anchor="bottom-center"
        :offset="{ x: 0, y: -50 }"
      >
        <div class="bg-white p-3 px-4 rounded-lg shadow-lg max-w-[200px]">
          <p class="m-0 mb-2">
            Vue content styled by your app.
          </p>
          <button @click.stop="showPopup = false">
            Close
          </button>
        </div>
      </ScriptGoogleMapsOverlayView>
    </ScriptGoogleMapsMarker>
  </ScriptGoogleMaps>
</template>
```

## Dynamic Markers

Use `**v-for**` with a reactive array to add and remove markers dynamically.

```vue
<script setup lang="ts">
const markers = ref([
  { lat: -33.8568, lng: 151.2153 },
  { lat: -33.8688, lng: 151.2093 },
])

function addMarker() {
  markers.value.push({
    lat: -33.86 + Math.random() * 0.02,
    lng: 151.20 + Math.random() * 0.02,
  })
}
</script>

<template>
  <ScriptGoogleMaps
    :map-options="{
      center: { lat: -33.8688, lng: 151.2093 },
      zoom: 13,
    }"
  >
    <ScriptGoogleMapsMarker
      v-for="pos in markers"
      :key="`${pos.lat},${pos.lng}`"
      :position="pos"
    />
  </ScriptGoogleMaps>
  <button @click="addMarker">
    Add Marker
  </button>
</template>
```

[Edit this page](https://github.com/nuxt/scripts/edit/main/docs/content/google-maps/1.guides/4.markers-and-info-windows.md)

[Markdown For LLMs](https://scripts.nuxt.com/scripts/google-maps/guides/markers-and-info-windows.md)

[**Map Styling** Style interactive and static maps with JSON rules, cloud map IDs, and color mode.](https://scripts.nuxt.com/scripts/google-maps/guides/map-styling) [**Example: Shapes & Overlays** Draw circles, polygons, polylines, rectangles, and GeoJSON data on a Google map.](https://scripts.nuxt.com/scripts/google-maps/guides/shapes-and-overlays)

**On this page **

- [Simple Markers](#simple-markers)
- [Colored Pins](#colored-pins)
- [Custom HTML Markers](#custom-html-markers)
- [Info Windows](#info-windows)
- [Custom Popups with OverlayView](#custom-popups-with-overlayview)
- [Dynamic Markers](#dynamic-markers)

```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/guides/markers-and-info-windows#webpage","@type":"WebPage","description":"Add advanced markers, info windows, and custom HTML popups to a Google map.","name":"Example: Markers & Info Windows","url":"https://scripts.nuxt.com/scripts/google-maps/guides/markers-and-info-windows","breadcrumb":{"@id":"https://scripts.nuxt.com/scripts/google-maps/guides/markers-and-info-windows#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/scripts/google-maps/guides/markers-and-info-windows"]}],"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/guides/markers-and-info-windows#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":"Guides","item":"https://scripts.nuxt.com/scripts/google-maps/guides","position":4},{"@type":"ListItem","name":"Example: Markers & Info Windows","item":"https://scripts.nuxt.com/scripts/google-maps/guides/markers-and-info-windows","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.
