The Mapbox Map component for Retool Apps
A content area to embed a map with custom locations.
An embedded map using MapBox to display latitude and longitude coordinates as points of interest. It supports custom markers using Emoji and symbols, default coordinates and zoom level, and GeoJSON to render custom shapes for highlighting locations.
Mapbox Map can trigger queries when panning or zooming the map, and on hover start or end for points.
Refer to the Mapbox guide for more information about using this component.
Properties
All properties for this object with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read property values.
events
A list of configured event handlers that trigger actions or queries.
Type | array |
Array values | object |
Configurability | Inspector > Interaction > Event handlers |
Default | null |
Array Object Properties
event
The event that triggers the action. Refer to the events section for details of available events for this object.
Type | string |
Configurability | Inspector > Interaction > Event handlers > Event |
Default | null |
method
The JavaScript method to perform when type
is datasource
, widget
, state
, or localStorage
.
Type | string |
Configurability | Inspector > Interaction > Event handlers > Edit event handler > Run script actions |
Default | null |
type
The type of action to perform.
Type | string | ||||||||||||||
Configurability | Inspector > Interaction > Event handlers > Edit event handler > Action | ||||||||||||||
Allowed Values |
| ||||||||||||||
Default | null |
fitBoundsToGeoJson
Whether to fit the map bounds to the GeoJSON data.
Type | boolean |
Configurability | Inspector |
Default | null |
geoJson
GeoJSON objects to display on the map, such as polygons.
Type | object |
Configurability | Inspector |
Default | null |
geoJsonLayerStyle
Mapbox GeoJSON layer styles that override any other applied styling.
Type | object |
Configurability | Inspector |
Default | null |
hidden
Whether this object is hidden from view.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Hidden |
Default | false |
Examples
true
hoveredOverPoint
The point on which the cursor hovers.
Type | object |
Configurability | Read-only |
Default | null |
id
The unique identifier (name).
Type | string |
Format | Plain Text |
Configurability | Inspector |
Default | mapboxMap1 |
Examples
query1
button1
isHiddenOnDesktop
Whether to show or hide this object in the desktop layout.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Advanced > Show on desktop |
Default | false |
Examples
true
isHiddenOnMobile
Whether to show or hide this object in the mobile layout.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Advanced > Show on mobile |
Default | true |
Examples
true
latitudeColumnName
The key for latitude values if different from latitude
.
Type | string |
Configurability | Inspector |
Default | null |
longitudeColumnName
The key for longitude values if different from longitude
.
Type | string |
Configurability | Inspector |
Default | null |
maintainSpaceWhenHidden
Whether to take up space on the canvas if hidden
is true
.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Advanced > Maintain space when hidden |
Default | false |
Examples
true
margin
The amount of margin to render outside.
Type | string | |||||||||
Format | Plain Text | |||||||||
Configurability | Inspector > Spacing > Margin | |||||||||
Allowed Values |
| |||||||||
Default | 4px 8px |
Examples
4px 8px
onPointHoveredOver
The event handler to run when a point is hovered over.
Type | string |
Configurability | Read-only |
Default | null |
onPointHoveredOverEnd
The event handler to run when a point is no longer hovered over.
Type | string |
Configurability | Read-only |
Default | null |
onPointSelected
The event handler to run when a point is selected.
Type | string |
Configurability | Read-only |
Default | null |
onViewportChange
The event handler to run when the viewport changes.
Type | string |
Configurability | Read-only |
Default | null |
points
A list of map points to display.
Type | array |
Array values | object |
Configurability | Inspector |
Default | null |
Array Object Properties
showCurrentLngLat
Whether to show the latitude and longitude coordinates.
Type | boolean |
Configurability | Inspector |
Default | null |
showInEditor
Whether the component remains visible in the editor if hidden
is true
.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Advanced > Always show in edit mode |
Default | false |
Examples
true
visiblePoints
A list of map points visible.
Type | array |
Array values | object |
Configurability | Read-only |
Default | null |
Methods
JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
mapboxMap.scrollIntoView()
Scrolls the canvas or parent container so that the selected component appears in the visible area.
mapboxMap.scrollIntoView(options)
Parameters
Object Properties
behavior
The scroll behavior.
Type | string | ||||||
Allowed Values |
|
block
The scroll position relative to the component.
Type | string | ||||||||||
Allowed Values |
|
Examples
Scroll the minimum amount to immediately bring mapboxMap
into view.
mapboxMap.scrollIntoView({behavior: 'auto', block: 'nearest'});
mapboxMap.selectPoint(latitude, longitude)
mapboxMap.setMapCenter(options)
Events
Events triggered by user interactions. You can configure event handlers in the IDE to trigger queries or other actions in response to events.
Event | Description |
---|---|
On Point Hovered Over | A point of interest is hovered over. |
On Point Hovered Over End | A point of interest is no longer hovered over. |
On Point Selected | A point of interest is selected. |
On Viewport Change | The viewport is changed. |