Skip to main content
RapidDev - Software Development Agency
bubble-tutorial

How to embed Google Maps in Bubble

Embedding Google Maps in Bubble can be done using the native Map element for quick setup or an HTML element with the Google Maps embed API for custom styling. This tutorial covers both approaches, explains when to use each, shows how to add custom markers and info windows, and demonstrates styling the map appearance to match your app's design.

What you'll learn

  • How to use Bubble's native Map element for quick map embedding
  • How to use an HTML element for custom Google Maps embeds
  • How to add markers and info windows to maps
  • How to style maps to match your app design
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner5 min read15-20 minAll Bubble plansMarch 2026RapidDev Engineering Team
TL;DR

Embedding Google Maps in Bubble can be done using the native Map element for quick setup or an HTML element with the Google Maps embed API for custom styling. This tutorial covers both approaches, explains when to use each, shows how to add custom markers and info windows, and demonstrates styling the map appearance to match your app's design.

Overview: Embedding Google Maps in Bubble

This tutorial shows two ways to embed Google Maps: Bubble's built-in Map element and custom HTML embeds. You will learn when each approach is best, how to add dynamic markers, and how to customize map appearance.

Prerequisites

  • A Bubble app on any plan
  • A Google Maps API key configured in Settings → General
  • Data with geographic address fields or coordinates

Step-by-step guide

1

Use Bubble's native Map element

Drag a Map element from the Element Palette onto your page. Set its data source to a search that returns records with geographic address fields (e.g., Do a Search for Locations). Set the marker address field to the geographic address field on your Data Type. The Map element automatically places markers for each result. Set the map's initial center to a specific address or Current geographic position. Configure zoom level in the element properties. This is the fastest way to get a working map.

Expected result: A Google Map displays with markers for your database records.

2

Embed a custom map via HTML element

For more control over map styling and behavior, use an HTML element with the Google Maps JavaScript API. Add an HTML element and paste a script that creates a google.maps.Map instance. Set the container div size, center coordinates, zoom level, and map style. The HTML approach lets you use custom marker icons, styled map themes (like dark mode), info windows with rich content, marker clustering, and custom controls that are not available through the native Map element.

Custom Google Maps embed (HTML element)
1<div id="map" style="width:100%;height:400px;"></div>
2<script>
3function initMap() {
4 var map = new google.maps.Map(document.getElementById('map'), {
5 center: {lat: 40.7128, lng: -74.0060},
6 zoom: 12,
7 styles: [] // Add custom style array here
8 });
9 // Add markers dynamically
10}
11initMap();
12</script>

Expected result: A fully customizable Google Map renders in your Bubble page with your chosen styles and controls.

3

Add dynamic markers from your database

For the native Map element, markers are added automatically from the data source. For the HTML approach, you need to pass Bubble data to the JavaScript. One method: store location data in a hidden Repeating Group, then use JavaScript to read the rendered data and create markers. Another method: use the Toolbox plugin's Run JavaScript action to create markers from workflow data. Each marker can have a custom icon URL, title, and click handler that shows an info window.

Expected result: Markers appear on the map representing your database records, with info windows showing details on click.

4

Style the map to match your app design

Google Maps supports custom styling via a JSON style array. Use the Google Maps Styling Wizard (mapstyle.withgoogle.com) to create a custom style — choose from presets like Dark, Retro, Night, or create your own by adjusting colors for roads, water, landmarks, and labels. Copy the generated JSON style array and paste it into the styles property of your Map initialization. For the native Map element, custom styling options are limited — the HTML approach is recommended for styled maps.

Expected result: The map appearance matches your app's color scheme and design aesthetic.

Complete working example

Workflow summary
1GOOGLE MAPS EMBEDDING OPTIONS
2===============================
3
4OPTION A: NATIVE MAP ELEMENT
5 Drag Map element Set data source Set marker field
6 Pros: Quick setup, auto-updates, no code
7 Cons: Limited styling, basic markers only
8
9OPTION B: HTML ELEMENT EMBED
10 HTML element with Google Maps JavaScript API
11 Pros: Custom styles, marker icons, info windows, clustering
12 Cons: Requires JavaScript, manual data passing
13
14SETUP:
15 Settings General Google Maps API key
16 GCP: Enable Maps JavaScript API
17
18CUSTOM STYLING:
19 mapstyle.withgoogle.com Generate style JSON
20 Paste into: new google.maps.Map(el, {styles: [...]})

Common mistakes when embedding Google Maps in Bubble

Why it's a problem: Not enabling the Maps JavaScript API in Google Cloud Console

How to avoid: Go to GCP Console → APIs & Services → Library → enable Maps JavaScript API

Why it's a problem: Using the native Map element when custom styling is needed

How to avoid: Use the HTML element approach for any map that needs custom styling, themed appearance, or custom markers

Why it's a problem: Not restricting the Google Maps API key

How to avoid: Restrict the API key to your app's domain in the GCP Console under API key restrictions

Best practices

  • Restrict your Google Maps API key to your app's domain
  • Use the native Map element for simple marker displays
  • Use the HTML element approach for styled maps and custom markers
  • Set a reasonable default zoom level (12-14 for city-level, 4-6 for country-level)
  • Add loading indicators while the map initializes
  • Test map performance with many markers — consider marker clustering for 50+ points

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

I want to embed a styled Google Map in my Bubble.io app showing locations from my database with custom markers. Should I use the native Map element or an HTML embed? What are the trade-offs?

Bubble Prompt

Add a Google Map to my location listing page. Use the native Map element with data source set to my Locations Data Type. Show markers for each location. When a marker is clicked, show the location name and address in an info display.

Frequently asked questions

Is Google Maps free to use?

Google provides $200/month free credit (~28,000 map loads). Beyond that, pricing is per map load. Monitor usage in your Google Cloud Console billing dashboard.

Can I use Mapbox instead of Google Maps?

Yes. Embed Mapbox via an HTML element. Mapbox offers a generous free tier and more styling flexibility, though it requires JavaScript configuration.

How do I show the user's location on the map?

Use Bubble's Current geographic position data source to get the user's coordinates (requires browser permission). Pass these as the map center or add a special marker.

Can I show directions between two points?

Yes, but only via the HTML embed approach using Google's Directions API. The native Map element does not support directions.

Can RapidDev help implement maps in my Bubble app?

Yes. RapidDev can implement customized map features including styled maps, custom markers, route display, geolocation, and proximity search for your Bubble app.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.