Skip to main content

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.

fitBoundsToGeoJson

Whether to fit the map bounds to the GeoJSON data.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

geoJson

GeoJSON objects to display on the map, such as polygons.

Type object
Mutability
ControlUsage
Retool UI Inspector

geoJsonLayerStyle

Mapbox GeoJSON layer styles that override any other applied styling.

Type object
Mutability
ControlUsage
Retool UI Inspector

hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector > Appearance > Hidden
MethodsetHidden()
Default
false
Examples
true

hoveredOverPoint

The point on which the cursor hovers.

Type object
Mutability Read-only

id

The unique identifier (name).

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector
Default
mapboxMap1
Examples
query1
button1

isHiddenOnDesktop

Whether to show or hide this object in the desktop layout.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI 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
Mutability
ControlUsage
Retool UI Inspector > Appearance > Advanced > Show on mobile
Default
true
Examples
true

latitude

The latitudinal position.

Type number
Mutability
ControlUsage
Retool UI Inspector
MethodselectPoint()

latitudeColumnName

The key for latitude values if different from latitude.

Type string
Mutability
ControlUsage
Retool UI Inspector

longitude

The longitudinal position.

Type number
Mutability
ControlUsage
Retool UI Inspector
MethodselectPoint()

longitudeColumnName

The key for longitude values if different from longitude.

Type string
Mutability
ControlUsage
Retool UI Inspector

maintainSpaceWhenHidden

Whether to take up space on the canvas if hidden is true.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector > Appearance > Advanced > Maintain space when hidden
Default
false
Examples
true

margin

The amount of margin to render outside.

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector > Spacing > Margin
Allowed Values
ValueUI OptionDescription
4px 8pxNormal

Normal margin.

0None

No margin.

Default
4px 8px
Examples
4px 8px

onPointHoveredOver

The event handler to run when a point is hovered over.

Type string
Mutability Read-only

onPointHoveredOverEnd

The event handler to run when a point is no longer hovered over.

Type string
Mutability Read-only

onPointSelected

The event handler to run when a point is selected.

Type string
Mutability Read-only

onViewportChange

The event handler to run when the viewport changes.

Type string
Mutability Read-only

points

A list of map points to display.

Type array
Array values object
Mutability
ControlUsage
Retool UI Inspector
Array Object Properties

color

The color with which to render.

Type string
Mutability Read-only

id

The unique identifier for the point.

Type string
Mutability Read-only

latitude

The latitudinal position.

Type number
Mutability Read-only

longitude

The longitudinal position.

Type number
Mutability Read-only


pointValue

The point value to display.

Type object
Mutability Read-only

selectedPoint

The selected point.

Type object
Mutability Read-only

showCurrentLngLat

Whether to show the latitude and longitude coordinates.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

showInEditor

Whether the component remains visible in the editor if hidden is true.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector > Appearance > Advanced > Always show in edit mode
Default
false
Examples
true

style

Custom style options.

Type object
Mutability
ControlUsage
Retool UI Inspector > Appearance > style

visiblePoints

A list of map points visible.

Type array
Array values object
Mutability Read-only

zoom

The zoom level, from 0 to 16.

Type number
Mutability
ControlUsage
Retool UI Inspector

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.

Definition
mapboxMap.scrollIntoView(options)
Parameters

options

The scroll options.

Type object
Object Properties

behavior

The scroll behavior.

Type string
Allowed Values
ValueDescription
auto

Scroll immediately to the specified position.

smooth

Scroll gradually to the specified position.


block

The scroll position relative to the component.

Type string
Allowed Values
ValueDescription
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.



Examples

Scroll the minimum amount to immediately bring mapboxMap into view.

mapboxMap.scrollIntoView({behavior: 'auto', block: 'nearest'});

mapboxMap.selectPoint()

Select a point on the map.

Definition
mapboxMap.selectPoint(latitude, longitude)
Parameters

latitude

The latitudinal position.

Type number

longitude

The longitudinal position.

Type number


mapboxMap.setMapCenter()

Set the center of the map.

Definition
mapboxMap.setMapCenter(options)
Parameters

options

The latitude and longitude of the center of the map.

Type object
Object Properties

latitude

The latitudinal position.

Type number

longitude

The longitudinal position.

Type number



Events

Events triggered by user interactions. You can configure event handlers in the IDE to trigger queries or other actions in response to events.

EventDescription
On Point Hovered OverA point of interest is hovered over.
On Point Hovered Over EndA point of interest is no longer hovered over.
On Point SelectedA point of interest is selected.
On Viewport ChangeThe viewport is changed.