Skip to main content

The Map component for Retool Mobile

An embedded map with custom locations.

An embedded map using MapBox to display latitude and longitude coordinates as points of interest. It supports default coordinates and can trigger queries when selecting a point.

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.

aspectRatio

The ratio of width-to-height (e.g., 1.3 to use 4:3 ratio).

Type number
Format Float
Mutability
ControlUsage
Retool UI Inspector
Examples
1.3

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

latitude

The latitudinal position.

Type number
Mutability
ControlUsage
Retool UI Inspector
MethodselectPoint()

longitude

The longitudinal position.

Type number
Mutability
ControlUsage
Retool UI Inspector
MethodselectPoint()

mapStyle

The Mapbox style to use.

Type string
Mutability
ControlUsage
Retool UI Inspector
Allowed Values
ValueDescription
mapbox://styles/mapbox/streets-v12

Streets.

mapbox://styles/mapbox/satellite-v9

Satellite + Streets.

mapbox://styles/mapbox/outdoors-v12

Outdoors.

mapbox://styles/mapbox/light-v11

Light.

mapbox://styles/mapbox/dark-v11

Dark.

mapbox://styles/mapbox/navigation-day-v1

Navigation (Day).

mapbox://styles/mapbox/navigation-night-v1

Navigation (Night).


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


selectedPoint

The selected point.

Type 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.

map.scrollIntoView()

Scrolls the canvas or parent container so that the selected component appears in the visible area.

Definition
map.scrollIntoView(options)
Parameters

options Required

object

The scroll options.

Object Properties

behavior Required

string

The scroll behavior.

Supported Values
autoScroll immediately to the specified position.
smoothScroll gradually to the specified position.

block Required

string

The scroll position relative to the component.

Supported Values
nearestScrolls 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.
startScrolls to position the component at the top of the visible area.
centerScrolls to position the component in the middle of the visible area.
endScrolls to position the component at the bottom of the visible area.
Examples

Scroll the minimum amount to immediately bring map into view.

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

map.setHidden()

Set the hidden value to toggle whether the component is visible. Defaults to true without a parameter.

Definition
map.setHidden(hidden)
Parameters

hidden

boolean

Whether this object is hidden from view.

Examples

Hide map.

map.setHidden(true);

Unhide map.

map.setHidden(false);

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
Point PressedA point of interest is clicked or pressed or pressed.