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
Configurability Inspector
Defaultnull
Examples
1.3

events

A list of configured event handlers that trigger actions or queries.

Type array
Array values object
Configurability Inspector > Interaction > Event handlers
Defaultnull
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
Defaultnull

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
Defaultnull

type

The type of action to perform.

Type string
Configurability Inspector > Interaction > Event handlers > Edit event handler > Action
Allowed Values
ValueDescription
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).

Defaultnull


geoJson

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

Type object
Configurability Inspector
Defaultnull

geoJsonLayerStyle

Mapbox GeoJSON layer styles that override any other applied styling.

Type object
Configurability Inspector
Defaultnull

hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Configurability Inspector > Appearance > Hidden
Defaultfalse
Examples
true

latitude

The latitudinal position.

Type number
Configurability Inspector
Defaultnull

longitude

The longitudinal position.

Type number
Configurability Inspector
Defaultnull

mapStyle

The Mapbox style to use.

Type string
Configurability 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).

Defaultnull

points

A list of map points to display.

Type array
Array values object
Configurability Inspector
Defaultnull
Array Object Properties

color

The color with which to render.

Type string
Configurability Read-only
Defaultnull

id

The unique identifier for the point.

Type string
Configurability Read-only
Defaultnull

latitude

The latitudinal position.

Type number
Configurability Read-only
Defaultnull

longitude

The longitudinal position.

Type number
Configurability Read-only
Defaultnull


selectedPoint

The selected point.

Type object
Configurability Read-only
Defaultnull

zoom

The zoom level, from 0 to 16.

Type number
Configurability Inspector
Defaultnull

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

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

Whether this object is hidden from view.

Type boolean
Format True/False
Default
false
Examples
true

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.