A component to embed a Mapbox map. It can be used to display a map with markers.

For this component you need Mapbox access token: https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes

Fields

NameTypeDescriptionOptions
Access TokenTextAccess token from Mapbox-
Map styleTextMap style URL-
ZoomNumber--
LatitudeNumber--
LongitudeNumber--
MarkersObject--
Controls visibleBooleanShow map controls
  1. Yes
  2. No
Custom CSS classesTextCSS classes, separated by spaces. You can define classes in custom stylesheets.-

Events

Low code usage

This component can be declared directly in Python, using backend-driven UI.

ui.Mapbox(content={
        "accessToken": "", # str 
        "mapStyle": "", # str 
        "zoom": 0.0, # Union[float, str] 
        "lat": 0.0, # Union[float, str] 
        "lng": 0.0, # Union[float, str] 
        "markers": {}, # Union[Dict, str] 
        "controls": "yes", # str [yes, no]
        "cssClasses": "", # str 
    },
    handlers={
        "mapbox-marker-click": handle_event,
        "mapbox-click": handle_event,
    }
)

A function, in this example handle_event, should be implemented in your code to handle events.

def handle_event(state, payload, context, ui):
  pass

Reference