Map with markers
Show a place or a list of places in a map as markers, and bind those markers to a detail page! With the Map with Markers component, apps can display a map showing real locations in it.
You'll need:
  • Marker data, which should be a list of items containing, at least, a name and coordinates (latitude and longitude numeric values). You can replicate our sample Airtable base to get started.

👉 The Tags

To create the interactive map:
1
[component:map:interactive]
Copied!
To create the map as a fixed image with the markers, not movable or zoomable:
1
[component:map]
Copied!
To specify statically the center location of the map, and the zoom value:
1
[component:map:<latitude>:<longitude>:<zoom>]
Copied!
To require location permissions to the user in a certain app screen (place the tag in the top-level app page):
1
[require:location]
Copied!
To create a custom marker:
1
[asset:marker:default]
Copied!

⚒️ How to set it up

🎨 Design file setup

To add a map component in the design file, create a rectangle element and add the tag [component:map:interactive] to it. This element will show a map in the app after importing it to Bravo. In case you want the map to be a fixed image with all the markers (not movable or zoomable), add just [component:map].
If you need to use device location in the app (to center the map in that location, for instance), add the [require:location] tag in the app page layer. This will ask the user to share their location with the app when opening that screen. More on location variables here.
To center the map in a specific location point, use the [component:map:<latitude>:<longitude>:<zoom>] tag. <latitude> and <longitude> are the map center's coordinates. <zoom> needs to be a number from 0 (zoomed out) to 22 (zoomed all the way in). These values can also be bound to API data, as we'll show in the next section. To do that, do not specify any of the values in the tag, use just [component:map] or [component:map:interactive].
It is possible to customize how the map markers will look in the map when using the app. To do that, create a page-level component and add the tag [asset:marker:default] to it. Inside it, you can insert an SVG component or a PNG image with a transparent background.
The size of the marker icon in the map will be proportional to the size of the top-level component it's placed in on the design file (the one with the Bravo tag).
In case you want to show more data when a user clicks on the marker, you can bind a detail page to the map component. To do this, add a separate app page to the design file, and create a prototyping link from the map component to the screen.

🔌 Binding the map component to marker data

Once the design file is ready, import it into Bravo to bind it to the list of markers. The map component will be displayed in the Data Binding section, with some bindable properties.
As mentioned earlier, it is possible to center the map in a location point when the user opens the screen containing it. To do this, click on the map component and bind the Latitude, Longitude and Zoom features as shown below.
The map does not refresh automatically to center it in the user's location. However, you can send the user's location using location variables and setting up a request against a service called HTTPbin. You can bind that request to the center location properties (latitude and longitude) as shown below. This way, the map will be centered on the user's location the first time it is opened.
To display the markers in the map, it's necessary to bind the map component to a list of items coming from an API. These items must, at least, contain the following properties for each of the markers: latitude value, longitude value and name.
We'll set up a list request in the Data Collections section. This request will obtain a list with all the markers from the backend. You've got a sample Airtable base with marker data at the end of this guide.
To bind the data fetched with this list request, open the Map Marker component shown below. Then, we'll need to bind a list of markers to the Points property. This data item must be a list, containing all the marker data.
After binding the list, we'll bind the individual properties of each marker, Name, Latitude and Longitude, to their corresponding data items.
Finally, to bind the data for the detail page, we'll need a detail request returning a single item from the marker list. In case you use our sample Airtable base, and use the import wizard in the Data Collections section, this request will already be set up for you. Once the request is created, we can bind the data to the detail page.

📲 Preview on Bravo Vision

Now, you'll be able to preview the map with the markers on Bravo Vision!

💾 Example files

Bravo Sample: Maps with Markers
Figma
Last modified 20d ago