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.
Settings
Mapbox Map includes the following configurable options when building apps in the IDE.
Properties
All properties for Mapbox Map with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read property values.
Properties
method
The JavaScript method to perform when type
is datasource
, widget
, state
, or localStorage
.
Values
datasource | Control query. |
widget | Control component. |
script | Run script. |
state | Set variable. |
localStorage | Set localStorage. |
util | Perform utility action (e.g., Open URL or Confetti). |
fitBoundsToGeoJson
Whether to fit the map bounds to the GeoJSON data.
GeoJSON objects to display on the map, such as polygons.
geoJsonLayerStyle
Mapbox GeoJSON layer styles that override any other applied styling.
global
Whether the object is globally scoped for use in all app pages.
Whether the component is visible.
hoveredOverPoint
The point on which the cursor hovers.
id
The unique identifier.
isHiddenOnDesktop
Whether the component is visible in the desktop layout.
isHiddenOnMobile
Whether the component is visible in the mobile layout.
latitudeColumnName
The key for latitude values if different from latitude
.
longitudeColumnName
The key for longitude values if different from longitude
.
maintainSpaceWhenHidden
Whether the component takes up space on the canvas if hidden
is true
.
pluginType
The plugin type.
pointValue
The point value to display.
selectedPoint
The selected point.
showCurrentLngLat
Whether to show the latitude and longitude coordinates.
showInEditor
Whether to remain visible in the editor if hidden
is true
.
viewport
Details about the visible map view.
visiblePoints
A list of map points visible.
Methods
JavaScript API methods for interacting with Mapbox Map. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
scrollIntoView
Scrolls the canvas or parent container so that the selected component appears in the visible area.
mapboxMap.scrollIntoView(scrollIntoViewOptions)
Parameters
scrollIntoViewOptions
The scroll options.
Properties
behavior
The scroll behavior.
Values
auto | Scroll immediately to the specified position. |
smooth | Scroll gradually to the specified position. |
block
The scroll position relative to the component.
Values
nearest | Scrolls only the minimum amount required for the component to appear in the visible area. Scrolling does not occur if the component is already in view. |
start | Scrolls to position the component at the top of the visible area. |
center | Scrolls to position the component in the middle of the visible area. |
end | Scrolls to position the component at the bottom of the visible area. |
selectPoint
Select a point on the map.
setMapCenter
Set the center of the map.
Events
Events are triggered by user interactions, such as clicking a button or entering a value. Use event handlers to trigger queries or other actions in response to events.
onPointHoveredOver
A point is hovered over.
onPointHoveredOverEnd
A point is no longer hovered over.