From 9d15300991245581feb550e33908be76236b6232 Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Fri, 17 Apr 2026 11:29:52 +1000 Subject: [PATCH 1/3] fix(google-maps): allow map styling guide to work with markers Closes #716 JSON `mapOptions.styles` previously dropped `mapId`, breaking `AdvancedMarkerElement` which v1 `ScriptGoogleMapsMarker` requires. Always pass `mapId` through; add a dev warning when `styles` is set pointing users to cloud-based styling. --- .../google-maps/1.guides/2.map-styling.md | 10 +++++++--- .../components/GoogleMaps/ScriptGoogleMaps.vue | 17 +++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/docs/content/scripts/google-maps/1.guides/2.map-styling.md b/docs/content/scripts/google-maps/1.guides/2.map-styling.md index 0cbecdf2a..ca878264c 100644 --- a/docs/content/scripts/google-maps/1.guides/2.map-styling.md +++ b/docs/content/scripts/google-maps/1.guides/2.map-styling.md @@ -2,13 +2,17 @@ title: Map Styling --- -Google Maps supports two styling approaches: legacy JSON styles and cloud-based map IDs. Both work with Nuxt Scripts, including the static map placeholder. +Google Maps supports two styling approaches: legacy JSON styles and cloud-based map IDs. Cloud-based map IDs are the recommended approach for v1 and work with `ScriptGoogleMapsMarker`. ## JSON Styles +::callout{color="amber"} +JSON `styles` conflict with `ScriptGoogleMapsMarker` in v1. `AdvancedMarkerElement` requires a `mapId`, and Google Maps ignores `styles` when a `mapId` is present. If you need markers, use [cloud-based map IDs](#cloud-based-map-ids) instead. +:: + Use the `mapOptions.styles` prop with a JSON style array. You can find pre-made styles on [Snazzy Maps](https://snazzymaps.com/). -Styles automatically apply to both the static map placeholder and the interactive map. +Styles apply to the static map placeholder and to the interactive map when the map has no markers. ```vue