Component props reference for dash_leaflet2.

API reference

dash_leaflet2

AttributionControl

AttributionControl adds an explicitly-controlled attribution box to the map. Place it as a child of dl2.Map with attributionControl=False to take over from the bundled default; both position and prefix are two-way (mutable from Python callbacks). Pass prefix=False to hide the "Leaflet" link.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
classNamestringOften-used CSS class name(s) for the root element.
positionone of 'topleft', 'topright', 'bottomleft', 'bottomright''bottomright'Map control position. Default 'bottomright'. [MUTABLE]
prefixstring \boolHTML shown before the layer attributions. Default Leaflet's "Leaflet" link. Pass False (or empty string) to hide the prefix entirely. [MUTABLE]
styledictInline style for the root element. For Map, this is where you set height.

BaseLayer

BaseLayer wraps a layer (typically a TileLayer) and registers it as a base layer in the parent LayersControl. Bases are mutually exclusive (radio). Place it as a child of LayersControl, with a single layer component (e.g. TileLayer) as its own child.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
checkedboolfalseInitially selected base layer? Exactly one base is active at a time.
childrennodeThe Leaflet layer (typically a dl2.TileLayer) controlled by this entry.
classNamestringOften-used CSS class name(s) for the root element.
namestring'Base'Display name shown in the LayersControl (also the radio's identity).
styledictInline style for the root element. For Map, this is where you set height.

Circle

Circle draws a circle with a radius in meters (it grows/shrinks with zoom). For a fixed-pixel circle use CircleMarker. Place it as a child of Map. Wraps Leaflet 2's Circle.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
centertuple[51.505, -0.09]Center as [lat, lng]. [MUTABLE]
childrennodePopup / Tooltip children.
classNamestringOften-used CSS class name(s) for the root element.
colorstring'#3388ff'Stroke color. [MUTABLE]
fillColorstringFill color (defaults to stroke color). [MUTABLE]
fillOpacitynumber0.2Fill opacity, 0..1. [MUTABLE]
n_clicksnumberTimes the circle has been clicked. [READONLY]
radiusnumber100Radius in METERS (geographic). [MUTABLE]
styledictInline style for the root element. For Map, this is where you set height.
weightnumber3Stroke width in pixels. [MUTABLE]

CircleMarker

CircleMarker draws a circle with a fixed pixel radius (it stays the same size at every zoom). For a metric radius use Circle. Place it as a child of Map. Wraps Leaflet 2's CircleMarker.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
centertuple[51.505, -0.09]Center as [lat, lng]. [MUTABLE]
childrennodePopup / Tooltip children.
classNamestringOften-used CSS class name(s) for the root element.
colorstring'#3388ff'Stroke color. [MUTABLE]
fillColorstringFill color (defaults to stroke color). [MUTABLE]
fillOpacitynumber0.2Fill opacity, 0..1. [MUTABLE]
interactiveboolWhether the circle captures pointer events (fires clicks, blocks the map click underneath). Set false for a non-interactive decoration / context overlay so it never intercepts clicks meant for the map. Construction-only. @default true
n_clicksnumberTimes the marker has been clicked. [READONLY]
radiusnumber10Radius in PIXELS (fixed; does not scale with zoom). [MUTABLE]
styledictInline style for the root element. For Map, this is where you set height.
weightnumber3Stroke width in pixels. [MUTABLE]

EasyButton

EasyButton adds a single-icon control to the map. Use it for quick map-level actions (open a panel, locate, zoom-home, etc.); the click is reported back to Dash as n_clicks. Icons come from Iconify (any of the 200k+ icons), e.g. "mdi:emoticon-happy-outline". Place it as a child of dl2.Map.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
classNamestringOften-used CSS class name(s) for the root element.
iconstring'mdi:circle-medium'Iconify icon name, e.g. "mdi:emoticon-happy-outline" or "mdi:crosshairs-gps".
iconSizenumber18Icon size in pixels.
n_clicksnumber0Number of times the button has been clicked. [READONLY]
n_dblclicksnumber0Number of times the button has been double-clicked. [READONLY]
positionstring'topleft'"topleft" \"topright" \"bottomleft" \"bottomright".
styledictInline style for the root element. For Map, this is where you set height.
titlestringTooltip text shown on hover.

EditControl

EditControl renders a Leaflet draw/edit toolbar (native v2 — leaflet-draw is Leaflet 1-only). Place it as a child of dl2.Map. Shapes are kept in an internal FeatureGroup and surfaced via the geojson prop. The Edit section appears only when at least one shape exists. A contextual sub-toolbar appears while a tool is active (Finish / Delete last point / Cancel during draw; Save / Cancel during edit; Clear all / Cancel during remove).

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
actiondictThe most recent action, dash-leaflet-shaped: {layer_type: 'polygon', type: 'created'\'edited'\'deleted', n_actions: int} Bumps every time something happens — useful as a sole Input for "anything changed". [READONLY]
activeModeone of 'edit', 'remove'The currently active edit/remove mode, or null. [READONLY]
activeToolone of 'text', 'circle', 'marker', 'polyline', 'polygon', 'rectangle', 'circlemarker'The currently active draw tool, or null. Emitted whenever a tool is activated or cleared — pages can use this to open a popover when the user clicks a draw icon (mirrors the /easy-button popover-on-button-click pattern). [READONLY]
classNamestringOften-used CSS class name(s) for the root element.
drawobjectOfPer-tool enable/disable for the Draw section, e.g. {rectangle: False, marker: True}. Tools not listed default to enabled.
drawToolbardictPython -> control: setting this prop activates a draw tool or dispatches an action on the currently active tool. Bump n_clicks to ensure the prop registers as changed. Shape: {mode?: tool name, action?: 'finish'\'cancel'\'delete last point', n_clicks: int}. [MUTABLE]
editobjectOfPer-mode enable/disable for the Edit section, e.g. {remove: False}. Modes not listed default to enabled. The Edit section only appears once at least one shape exists.
editToolbardictPython -> control: enter edit/remove mode or dispatch save/cancel/clear-all. Bump n_clicks to ensure the prop changes. Shape: {mode?: 'edit'\'remove', action?: 'save'\'cancel'\'clear all', n_clicks: int}. [MUTABLE]
featureClickdictThe most recent feature click. Only fires while editMode === 'edit' — clicks on features in normal view mode do NOT emit this. The click is NOT propagated to the map (we set bubblingMouseEvents: false) so a Map.clickData callback only fires on empty-map clicks. Shape: {id, layerType, n_clicks}. [READONLY]
featureUpdatedictPython -> control: update or remove a single feature by its _dl2_id. Bump n_clicks each call to ensure the prop registers as changed. Shape: {id, style?, properties?, remove?, n_clicks} - style: Leaflet path style options to apply via setStyle (color, weight, fillOpacity, ...) - properties: merged into the feature's properties (e.g. {name: "Lighthouse"}) - remove: drop the feature from the FeatureGroup [MUTABLE]
geojsonobjectAll currently drawn shapes as a GeoJSON FeatureCollection. [READONLY]
lastActionobjectBrief metadata for the most recent draw / delete event (legacy shape). [READONLY]
measurementSystemone of 'metric', 'imperial''metric'Unit system for the live drawing previews — drives the radius readout in the circle tool and the area readout in the rectangle tool. - 'metric' (default): meters / kilometers for distance; m² / hectares / km² for area. - 'imperial' (US customary): feet / miles for distance; ft² / acres / mi² for area. Each formatter auto-picks the largest readable unit for the current magnitude (e.g. a 5 km radius reads "5.00 km"; a 50 m radius reads "50 m"). [MUTABLE]
n_drawnnumberTotal shapes drawn since mount (decrements on delete). [READONLY]
positionstring'topleft'Control position: "topleft" \"topright" \"bottomleft" \"bottomright".
shapeOptionsobject{ color: '#2f9e44', weight: 3, fillOpacity: 0.2 }Path style applied to drawn vectors (color, weight, fillOpacity, ...).
showMeasurementTooltipsboolfalseWhen true, every committed shape gets a permanent Leaflet tooltip showing its measured area (rectangle / circle / polygon) or length (polyline), formatted with the configured measurementSystem. [READONLY]
styledictInline style for the root element. For Map, this is where you set height.

FeatureGroup

FeatureGroup is like LayerGroup but extends leaflet.FeatureGroup — it can emit a combined GeoJSON of its vector children and broadcasts a single click event no matter which child was clicked. Use it when grouping shapes you want to treat as one unit (typical companion for EditControl). Wraps Leaflet 2's FeatureGroup.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
childrennodeAny number of layer children (Marker, Polygon, Circle, ...).
classNamestringOften-used CSS class name(s) for the root element.
geojsonobjectCombined GeoJSON FeatureCollection of all children (vectors only). [READONLY]
n_clicksnumberNumber of times any child layer has been clicked. [READONLY]
n_layersnumberNumber of times the group's children were modified. [READONLY]
styledictInline style for the root element. For Map, this is where you set height.

FullScreenControl

FullScreenControl adds a single button to the map that toggles the map container in/out of the browser's native fullscreen mode. Leaflet 2 doesn't ship a fullscreen control — this maps the browser's requestFullscreen() API onto a small Control subclass, matching the dash-leaflet (and Leaflet.fullscreen plugin) API shape.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
classNamestringOften-used CSS class name(s) for the root element.
fullscreenboolWhether the map is currently in fullscreen mode. [READONLY]
n_clicksnumberNumber of times the button has been clicked. [READONLY]
positionone of 'topleft', 'topright', 'bottomleft', 'bottomright''topleft'"topleft" \"topright" \"bottomleft" \"bottomright". Default "topleft". [MUTABLE]
styledictInline style for the root element. For Map, this is where you set height.
titlestring'Full Screen'Tooltip text when entering fullscreen. Default "Full Screen".
titleCancelstring'Exit Full Screen'Tooltip text when leaving fullscreen. Default "Exit Full Screen".

GeoJSON

GeoJSON renders a GeoJSON object — typically fed from a Python callback via the data prop. Set cluster=True to collapse dense point sets via SuperCluster (the same backend dash-leaflet 1's clustering uses). Custom pointToLayer / clusterToLayer JS strings plus a hideout passthrough let you style features without round-tripping through Python. Place it as a child of Map. Wraps Leaflet 2's GeoJSON layer.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
childrennodePopup / Tooltip children bound to the whole layer.
classNamestringOften-used CSS class name(s) for the root element.
clickFeatureobjectproperties of the most recently clicked feature. [READONLY]
clusterboolfalseTurn on supercluster-based point clustering. Markers within superClusterOptions.radius pixels collapse into a single cluster bubble; zooming in expands them. Only point geometries cluster; vector features (LineString, Polygon) are passed through unchanged.
clusterToLayerstringJavaScript source for a function that builds the layer shown in place of a SuperCluster cluster. Signature: (feature, latlng, index, ctx) => Layer. The default is a small DivIcon with the cluster's point count.
dataobjectA GeoJSON FeatureCollection / Feature / geometry object. [MUTABLE]
hideoutobjectOfArbitrary pass-through data made available to pointToLayer / clusterToLayer as ctx.hideout. Use it to ship colour maps, label dictionaries, or threshold values from Python without re-evaluating the JS function. [MUTABLE]
n_clicksnumberNumber of times any feature has been clicked. [READONLY]
pointToLayerstringJavaScript source for a function that converts an individual point feature into a layer. Signature: (feature, latlng, ctx) => Layer, where ctx = { hideout, leaflet, map }. Pass the function body as a string; it is wrapped in new Function(...) at construction time. The default uses the bundled DEFAULT_ICON.
spiderfyOnMaxZoomboolfalseReserved for future support — at max zoom, "spiderfy" overlapping markers into a ring so each is individually selectable. Currently a no-op (clicking the cluster at maxZoom still triggers zoomToBoundsOnClick).
styleobject \dictPath style applied to all vector features, e.g. {color, weight, fillOpacity}. [MUTABLE] Inline style for the root element. For Map, this is where you set height.
superClusterOptionsobjectOfTuning for the underlying SuperCluster index: { radius, minPoints, maxZoom, minZoom, extent }. Defaults: { radius: 80, minPoints: 2, maxZoom: 16, minZoom: 0, extent: 512 }. See https://github.com/mapbox/supercluster#options for the full list.
zoomToBoundsOnClickbooltrueIf true, clicking a cluster fits the map to that cluster's children's bounds. Default true.

ImageOverlay

ImageOverlay drapes a single static image over a geographic bounding box. With editable it gains a TextMarker-style transform control system: click to select, drag to move, a corner handle to resize (scaling the bounds about the anchor), and a top handle to rotate (a visual CSS rotation pivoting at the anchor). The white anchor dot marks where the image is pinned. bounds, rotation, and selected round-trip back to Dash. Wraps Leaflet 2's ImageOverlay.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
altstringAlt-text / title for the image element.
anchorone of 'center', 'left', 'right', 'bottom', 'top', 'top-left', 'top-right', 'bottom-left' …'center'Which point of the image is the rotation pivot + resize anchor + where the white anchor dot is drawn. One of center \top-left \top \top-right \left \right \bottom-left \bottom \bottom-right. @default "center". [MUTABLE]
boundsobjectOf[[0, 0], [0, 0]]Geographic bounds the image is stretched to, [[south, west], [north, east]]. Two-way when editable: dragging / resizing writes it back. [MUTABLE]
classNamestringOften-used CSS class name(s) for the root element.
crossOriginstringAdds the crossOrigin attribute to the img element. Pass "anonymous" to make the image load CORS-mode so canvas captures (map screenshots / html2canvas) can read the pixels. The host must answer with Access-Control-Allow-Origin or the image fails to load entirely — leave unset for hosts you don't control. "use-credentials" and "" are also valid. Construction-time only.
editableboolfalseEnable the on-map transform controls: click to select, then drag to move, drag the corner handle to resize, and the top handle to rotate. @default false.
interactiveboolfalseIf true, the image is wrapped in an interactive layer that fires click events. Forced on when editable.
n_clicksnumberNumber of times the image has been clicked. [READONLY]
n_transformsnumberBumped on each drag-move / resize commit. [READONLY]
opacitynumber1Layer opacity, 0..1. [MUTABLE]
rotationnumber0Visual rotation in degrees, CW. Applied as a CSS transform pivoting at the anchor (Leaflet's ImageOverlay has no native geographic rotation, so the image's bounds stay axis-aligned and only the rendered pixels rotate). The rotate handle writes it back. [MUTABLE]
selectedboolWhether the transform chrome (outline + resize/rotate handles) is shown. Two-way: clicking the image selects it, a map-background click clears it. Only meaningful when editable. [MUTABLE]
styledictInline style for the root element. For Map, this is where you set height.
urlstring''URL of the image. [MUTABLE]
zIndexnumberExplicit z-index for the overlay pane. [MUTABLE]

KeyboardControl

KeyboardControl installs a window-level keyboard listener that drives map rotation and pan. Place it as a child of <Map>. No DOM is rendered — it's a pure side-effect component. * Default behavior:

is suppressed by map.keyboard.disable() so the two don't both fire) This makes the page feel like a flight sim: the arrows turn the camera, the modifier is the "manual pan" escape hatch. Pages can flip the bindings by passing a custom keymap. Listens on window, not the map container — so a user pressing arrows while the map div doesn't have focus still rotates. Pages with form inputs should either set enabled=false while the form is focused or override the keymap.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
bearingStepnumber5Degrees of map bearing change per ArrowLeft / ArrowRight keypress. Default 5.
classNamestringOften-used CSS class name(s) for the root element.
enabledbooltrueWhether keyboard input is processed. When false, no key handler is installed. Useful for disabling controls while a modal/form is focused. [MUTABLE]
keymapobjectOfDirection map: each property holds the action ('rotate-cw', 'rotate-ccw', 'pan-up', 'pan-down', 'pan-left', 'pan-right') triggered by a given key + modifier combination. Defaults to: ArrowLeft → rotate-ccw (turn camera left) ArrowRight → rotate-cw (turn camera right) ArrowUp → rotate-ccw (same — feels natural for flight sims) ArrowDown → rotate-cw Cmd\Ctrl+ArrowLeft → pan-left Cmd\Ctrl+ArrowRight → pan-right Cmd\Ctrl+ArrowUp → pan-up Cmd\Ctrl+ArrowDown → pan-down Pages can override individual entries (e.g. flight sims that want ArrowUp/Down to be throttle, not rotation) by passing a partial object.
lastKeydictThe most recent key + action processed, as { key, action, modifier, ts }. [READONLY]
n_pansnumberNumber of pan keypresses processed. [READONLY]
n_rotationsnumberNumber of bearing changes emitted (each rotate keypress increments). Useful as the sole Input for "did the user rotate?". [READONLY]
panStepnumber80Pixels of map pan per Cmd+Arrow / Ctrl+Arrow keypress. Default 80 (matches Leaflet's own keyboard panOffset).
styledictInline style for the root element. For Map, this is where you set height.

LayerGroup

LayerGroup bundles N layers so they can be added/removed together. Drop child layers (Marker, Polygon, Circle, GeoJSON, ...) inside it; each is added to a shared leaflet.LayerGroup instead of the map directly. Place it as a child of dl2.Map — or of dl2.Overlay inside a LayersControl, to toggle the whole group as one entry. Wraps Leaflet 2's LayerGroup.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
childrennodeAny number of layer children (Marker, Polygon, Circle, GeoJSON, ...).
classNamestringOften-used CSS class name(s) for the root element.
styledictInline style for the root element. For Map, this is where you set height.

LayersControl

LayersControl renders a Leaflet control that lets the user pick one of N base layers and toggle M overlays. Place dl2.BaseLayer and dl2.Overlay as its children; LayersControl itself must be a child of dl2.Map.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
activeBasestringName of the active base layer. Two-way: reflects user choice + accepts callback. [MUTABLE]
activeOverlayslist of stringNames of currently visible overlays. Two-way. [MUTABLE]
childrennodeBaseLayer + Overlay children.
classNamestringOften-used CSS class name(s) for the root element.
collapsedbooltrueIf true, show only the toggle handle until the pointer enters.
positionstring'topright'"topright" \"topleft" \"bottomright" \"bottomleft".
styledictInline style for the root element. For Map, this is where you set height.

Map

Map is the root Leaflet 2 map container. It owns the Leaflet map instance and provides it to child layers (TileLayer, Marker) through React context. Set the height via the style prop.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
attributionControlbooltrueWhether Leaflet 2's built-in attribution control is added to the map. Default True (matches Leaflet's default). Set False when you want to mount a dl2.AttributionControl child and control position / prefix yourself — same convention as dash-leaflet's attributionControl=False + dl.AttributionControl(...) pairing. Constructor-only — changing it after the map is built has no effect.
bearingnumberMap rotation in degrees (CW from north). 0 = north up. Implemented as a CSS transform: rotate() on the leaflet map pane — the same technique leaflet-rotate uses on Leaflet 1.x. Leaflet 2 has no native rotation, so we build it the same way. Important caveat (CSS rotation, not coordinate-correct rotation): Tiles, markers, polygons, and zoom math are computed in Leaflet's un-rotated coordinate space and the whole pane is then rotated visually. That works perfectly for read-only views and follow-camera flight/walk sims (you look at the map; the camera tracks the player). It breaks subtly for INTERACTIVE drawing at non-zero bearing — a click lands at the visually-rotated screen position, which is no longer the same latlng Leaflet would resolve from the bare event coords. For drawing, keep bearing = 0. A fully coordinate-correct rotation is a much larger project (essentially porting leaflet-rotate's coord math to v2). [MUTABLE]
boxZoombooltrueShift-drag box-zoom selection. Default true. [MUTABLE]
centertuple[51.505, -0.09]Initial map center as [lat, lng]. Updating it from a callback re-centers the map. [MUTABLE]
childrennodeChild layers (TileLayer, Marker, ...) rendered into this map.
classNamestringOften-used CSS class name(s) for the root element.
clickDatadictData from the most recent map click: { latlng: [lat, lng] }. [READONLY]
doubleClickZoombooltrueDouble-click-to-zoom. Default true. [MUTABLE]
draggingbooltrueMouse / pointer drag panning. Default true. [MUTABLE]
flyTodictPython -> map: trigger a smooth viewport transition. The map calls the Leaflet 2 method indicated by transition and ignores the prop until n_clicks bumps again (matching drawToolbar / editToolbar / featureUpdate — needed so consecutive identical payloads still register as changes). Shape: { transition: 'setView' \'flyTo' \'panTo' \'fitBounds' \'flyToBounds' \'panInsideBounds', center?: [lat, lng], # for setView / flyTo / panTo zoom?: number, # optional zoom target (setView / flyTo) bounds?: [[s, w], [n, e]], # for fitBounds / flyToBounds / panInsideBounds options?: object, # passed straight to the Leaflet method # (duration, easeLinearity, animate, paddingTopLeft, ...) n_clicks: int, } flyTo / flyToBounds give the smooth glide-and-zoom motion; setView is instant; panTo glides without changing zoom. See the /flyto showcase. [MUTABLE]
keyboardbooltrueWhether the map can be panned / zoomed with the keyboard (arrow keys + +/-). Default true. [MUTABLE]
maxBoundstupleGeographic bounds the map's view is constrained inside, as [[south, west], [north, east]]. Panning past the edges is bounced back. [MUTABLE]
maxZoomnumberMaximum zoom level the user can zoom in to. When a TileLayer also sets maxZoom, Leaflet uses the smaller of the two. [MUTABLE]
minZoomnumberMinimum zoom level the user can zoom out to. When a TileLayer also sets minZoom, Leaflet uses the larger of the two (the most restrictive value wins). [MUTABLE]
n_moveendnumberCounter bumped on every moveend event (a pan / flyTo / fit completes). n_moveend < n_movestart means a transition is currently running. [READONLY]
n_movestartnumberCounter bumped on every movestart event (a pan / flyTo / fit begins). Pair with n_moveend to drive a "flying…" indicator. [READONLY]
pinchZoombooltruePinch-to-zoom on touch devices. Default true. In Leaflet 1.x this was called touchZoom; in v2 it's pinchZoom. [MUTABLE]
preferCanvasboolfalseIf true, render all vector layers through the Canvas renderer (preferred for dense point sets). [READONLY]
scrollWheelZoombooltrueMouse-wheel zoom. Default true. [MUTABLE]
styledictInline style for the root element. For Map, this is where you set height.
tapHoldboolMobile-safari tap-hold-to-contextmenu emulation. Defaults to true on mobile Safari only. [MUTABLE]
viewportdictCurrent view state, written back by the map on every moveend/zoomend as { center: [lat, lng], zoom, bearing, bounds: { north, south, east, west } }. Read this in callbacks. [READONLY]
zoomnumber13Initial zoom level. Updating it from a callback changes the zoom. [MUTABLE]
zoomControlbooltrueWhether Leaflet's built-in +/- zoom buttons control is added. Default true. Constructor-only — changing it after the map is built has no effect.

Marker

Marker displays an icon at a position and can host Popup/Tooltip children. The icon can be the default pin, a custom image (icon), an emoji, or any Iconify icon (iconify, e.g. "mdi:home"). Draggable markers write their new position back to Dash. Wraps Leaflet 2's Marker. Place it as a child of Map.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
childrennodePopup / Tooltip children bound to this marker.
classNamestringOften-used CSS class name(s) for the root element.
draggableboolfalseWhether the marker can be dragged with the pointer. [MUTABLE]
emojistringA single emoji to use as the marker, e.g. "🛥️".
iconobjectCustom image icon as Leaflet Icon options, e.g. {iconUrl, iconSize:[w,h], iconAnchor:[x,y]}.
iconAnchortuple[x, y] icon anchor for emoji / iconify / iconOptions markers. Default bottom-center.
iconColorstringCSS color for monochrome iconify icons.
iconOptionsobjectFull Leaflet DivIcon options escape hatch ({html, className, iconSize, iconAnchor}).
iconSizenumber32Pixel size for emoji / iconify markers. Default 32.
iconifystringAn Iconify icon name, e.g. "mdi:home" or "twemoji:sailboat" (loads from the Iconify API).
n_clicksnumberNumber of times the marker has been clicked. [READONLY]
n_dragsnumberNumber of times the marker has been dragged. [READONLY]
opacitynumber1Marker opacity, 0..1. [MUTABLE]
popupstringConvenience popup text. For rich content, use a <Popup> child instead.
positiontuple[51.505, -0.09]Marker position as [lat, lng]. Updating it moves the marker; dragging writes it back. [MUTABLE]
rotateWithMapboolfalseWhen true, the marker icon rotates together with the map — useful for vehicles, aircraft, walking characters, compass arrows, anything whose orientation is tied to the world. The icon's visual screen rotation is bearing + rotationAngle. When false (default), the icon stays in a fixed screen orientation regardless of map bearing — useful for pins, labels, and the typical "marker should always look upright" case. The icon's visual screen rotation is just rotationAngle. Implementation: when false we apply rotationAngle - bearing to the icon, which cancels the map pane's rotation contribution. When true we apply rotationAngle and let the pane's CSS rotation carry the icon.
rotationAnglenumber0Marker rotation in degrees (CW from north). Useful for vehicle / aircraft / character sprites that need to point in a direction. Applied via a CSS rotate on the icon DOM. [MUTABLE]
styledictInline style for the root element. For Map, this is where you set height.
tooltipstringConvenience tooltip text. For rich content, use a <Tooltip> child instead.
zIndexOffsetnumber0z-index offset relative to other markers. [MUTABLE]

MiniMap

MiniMap adds a small overview map in a corner of the main map. The overview tracks the main map's center + zoom (with a configurable offset) and draws a rectangle showing the main viewport. Click the corner toggle to collapse/expand. Place it as a child of dl2.Map. * Native Leaflet 2 — leaflet-minimap (the Leaflet 1 plugin) does not run on v2.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
aimingRectOptionsobject{ color: '#3388ff', weight: 1, fillColor: '#3388ff', fillOpacity: 0.15, interactive: false, }Leaflet path options for the aiming rectangle that shows the main map's viewport bounds on the minimap. Defaults to a translucent blue stroke.
attributionstring''Attribution shown by the inner minimap. Empty by default — the main map already attributes.
centerFixedtupleWhen set to [lat, lng], the inner minimap anchors on this point instead of tracking the main map's center. The aiming rectangle still reflects the main map's bounds — so the rectangle drifts off-minimap if the main map is panned far from the fixed point. Pass null (or omit) to follow the main map. Useful for "return-home" style affordances, where the minimap pins on a player / marker and clicking it (see n_clicks) snaps the main map back to them. [MUTABLE]
classNamestringOften-used CSS class name(s) for the root element.
heightnumber150Expanded height in pixels. Default 150.
minimizedboolWhether the minimap starts (or currently is) minimized. Two-way: setting it from a Python callback collapses/expands the minimap; the user clicking the toggle button also writes it back. [MUTABLE]
n_clicksnumber0Number of times the user has clicked anywhere on the inner minimap (excluding the corner expand/collapse toggle). Increments per click — pair with prevent_initial_call=True to use the minimap as a button. [READONLY]
positionone of 'topleft', 'topright', 'bottomleft', 'bottomright''bottomright'Control position: 'topleft' \'topright' \'bottomleft' \'bottomright'. Default 'bottomright'.
styledictInline style for the root element. For Map, this is where you set height.
toggleDisplaybooltrueShow the [⤡] toggle button. Default true.
urlstring'https://tile.openstreetmap.org/{z}/{x}/{y}.png'Tile URL template for the inner minimap basemap. Defaults to OSM.
widthnumber150Expanded width in pixels. Default 150.
zoomLevelOffsetnumber-5Zoom-level offset from the main map (negative = zoomed out further than the main). Default -5: a 150x150 minimap shows the main map's neighbourhood.

Overlay

Overlay wraps any layer and registers it as a toggleable overlay in the parent LayersControl (checkbox). Place it as a child of LayersControl, with a single layer component as its own child.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
checkedboolfalseInitially checked? Overlays are independent.
childrennodeThe Leaflet layer (TileLayer, GeoJSON, Marker, ...) controlled by this entry.
classNamestringOften-used CSS class name(s) for the root element.
namestring'Overlay'Display name shown in the LayersControl (also the checkbox's identity).
styledictInline style for the root element. For Map, this is where you set height.

Polygon

Polygon draws a filled, closed shape from a list of [lat, lng] points. Place it as a child of Map. Wraps Leaflet 2's Polygon.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
childrennodePopup / Tooltip children.
classNamestringOften-used CSS class name(s) for the root element.
colorstring'#3388ff'Stroke color. [MUTABLE]
fillColorstringFill color (defaults to stroke color). [MUTABLE]
fillOpacitynumber0.2Fill opacity, 0..1. [MUTABLE]
n_clicksnumberTimes the polygon has been clicked. [READONLY]
opacitynumber1Stroke opacity, 0..1. [MUTABLE]
positionslist of tuple[]Ring vertices as a list of [lat, lng] points (auto-closed). [MUTABLE]
styledictInline style for the root element. For Map, this is where you set height.
weightnumber3Stroke width in pixels. [MUTABLE]

Polyline

Polyline draws a multi-segment line from a list of [lat, lng] points. Place it as a child of Map. Wraps Leaflet 2's Polyline.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
childrennodePopup / Tooltip children.
classNamestringOften-used CSS class name(s) for the root element.
colorstring'#3388ff'Stroke color. [MUTABLE]
dashArraystringDash pattern, e.g. "5,10". [MUTABLE]
interactiveboolWhether the line captures pointer events (fires clicks, blocks the map click underneath). Set false for a non-interactive decoration / context overlay so it never intercepts clicks meant for the map. Construction-only. @default true
n_clicksnumberTimes the line has been clicked. [READONLY]
opacitynumber1Stroke opacity, 0..1. [MUTABLE]
positionslist of tuple[]Vertices as a list of [lat, lng] points. [MUTABLE]
styledictInline style for the root element. For Map, this is where you set height.
weightnumber3Stroke width in pixels. [MUTABLE]

Popup

Popup shows content in a balloon bound to its parent layer (Marker, Polygon, ...). Children are rendered through a React portal, so any Dash component works as popup content. Wraps Leaflet 2's Popup.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
autoCloseboolIf true, opening a popup closes other popups. Leaflet defaults to true; set False to allow multiple popups open simultaneously.
childrennodePopup content — any Dash/HTML children, rendered live via a React portal.
classNamestringOften-used CSS class name(s) for the root element.
closeButtonbooltrueShow the close (×) button.
closeOnClickboolIf true, clicking the map closes the popup. Leaflet defaults to true; set False for form popups that should stay open while the user is interacting.
maxWidthnumber300Max width in pixels.
minWidthnumber50Min width in pixels.
openedboolControlled open state — when set, the popup follows this prop (True → open, False → closed) instead of waiting for a click on the parent layer. [MUTABLE]
styledictInline style for the root element. For Map, this is where you set height.

Rectangle

Rectangle draws an axis-aligned box from geographic bounds. Place it as a child of Map. Wraps Leaflet 2's Rectangle.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
boundstuple[[0, 0], [0, 0]]Geographic bounds as [[south, west], [north, east]]. [MUTABLE]
childrennodePopup / Tooltip children.
classNamestringOften-used CSS class name(s) for the root element.
colorstring'#3388ff'Stroke color. [MUTABLE]
fillColorstringFill color (defaults to stroke color). [MUTABLE]
fillOpacitynumber0.2Fill opacity, 0..1. [MUTABLE]
n_clicksnumberTimes the rectangle has been clicked. [READONLY]
styledictInline style for the root element. For Map, this is where you set height.
weightnumber3Stroke width in pixels. [MUTABLE]

ScaleControl

ScaleControl shows a metric and/or imperial scale bar in a map corner. Wraps Leaflet 2's built-in Control.Scale (lives on the Control namespace but not exported by the ESM — we reach in through Control.Scale).

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
classNamestringOften-used CSS class name(s) for the root element.
imperialboolfalseShow imperial (mi/ft) bar. Default false.
maxWidthnumber100Maximum bar width in pixels. Default 100.
metricbooltrueShow metric (km/m) bar. Default true.
positionone of 'topleft', 'topright', 'bottomleft', 'bottomright''bottomleft'"topleft" \"topright" \"bottomleft" \"bottomright". Default "bottomleft". [MUTABLE]
styledictInline style for the root element. For Map, this is where you set height.
updateWhenIdleboolfalseOnly redraw the bar when the map stops moving. Default false.

TextMarker

TextMarker is editable, draggable, styleable text placed on the map like a Marker. Give it a position and text; drag to move, double-click to edit, and (when selected) use the on-canvas resize / rotate handles and the contextual toolbar to restyle it. Position, text, rotation, font size, and color all round-trip back to Dash. When position is omitted the label spawns at the center of the current viewport. Place it as a child of dl2.Map.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
anchorone of 'center', 'left', 'right', 'bottom', 'top', 'top-left', 'top-right', 'bottom-left' …'center'Which point of the text box sits on position. One of center \top-left \top \top-right \left \right \bottom-left \bottom \bottom-right. @default "center".
backgroundColorstring'transparent'Box background behind the text ("transparent" for none). Editable from the toolbar. [MUTABLE]
borderRadiusnumber6Corner radius of the background pill in px. @default 6.
classNamestringOften-used CSS class name(s) for the root element.
colorstring'#111827'Text color (any CSS color / Mantine var). Editable from the toolbar. [MUTABLE]
draggablebooltrueWhether the label can be dragged to a new position. @default true.
editablebooltrueWhether double-click enters inline text edit. @default true.
fontFamilystring'system-ui, sans-serif'Font family stack, e.g. "Inter, system-ui, sans-serif". [MUTABLE]
fontSizenumber24Font size in screen px (the resize handle changes this). [MUTABLE]
fontStyleone of 'normal', 'italic''normal'Font style: "normal" \"italic". [MUTABLE]
fontWeightstring \number600Font weight (400 / 600 / 700 / "bold" …). [MUTABLE]
n_clicksnumberNumber of times the label has been clicked. [READONLY]
n_dragsnumberNumber of times the label has been dragged. [READONLY]
n_editsnumberBumped on each committed text edit (fires a Dash Input even for identical text). [READONLY]
opacitynumber1Caption opacity, 0..1 — fade the whole label in/out (e.g. keyframed transitions). @,default,1 [MUTABLE]
paddingnumber6Box padding in px (only visible when backgroundColor is set). [MUTABLE]
positiontupleText anchor as [lat, lng]. Dragging the label writes it back. When omitted, the label is created at the current center of the map viewport (and that position is emitted back so Python has it). [MUTABLE]
referenceZoomnumberThe zoom level at which fontSize is the literal screen px (only used when scaleWithZoom). Defaults to the map's zoom when the label is created. [MUTABLE]
rotateWithMapboolfalseWhen true the label rotates together with a rotated map (Map.bearing); when false (default) it stays upright on screen regardless of map bearing — like a Marker.
rotationnumber0Rotation in degrees, CW from upright. The rotate handle changes this. [MUTABLE]
scaleWithZoomboolfalseGeographic sizing. When false (default) the label is a constant screen-size HUD caption: fontSize is literal screen px at every zoom (like a Tooltip). When true the label scales with the map — its on-screen size grows/shrinks by 2^(zoom − referenceZoom) so it keeps a fixed ground footprint as the camera flies (like a polygon's edge). [MUTABLE]
selectedboolShow selection chrome (resize / rotate handles + the style toolbar). Two-way: clicking the label sets it true and a map-background click clears it, so a host can also drive selection from the outside. [MUTABLE]
showToolbarbooltrueWhether the contextual style toolbar is shown while selected. @default true.
styledictInline style for the root element. For Map, this is where you set height.
textstring'Text'The caption string. Double-click the label to edit it inline; the committed text (on blur / Enter) is written back with n_edits bumped. [MUTABLE]

TileLayer

TileLayer loads and displays a raster tile basemap. Place it as a child of Map. Wraps Leaflet 2's TileLayer.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
attributionstring'&copy; OpenStreetMap contributors'Attribution HTML shown in the bottom-right of the map.
boundstupleGeographic bounds outside of which no tiles are requested, as [[south, west], [north, east]]. Same as Leaflet's LatLngBounds. Cheaper than server-side 404s for out-of-area requests.
classNamestringOften-used CSS class name(s) for the root element.
crossOriginstringAdds the crossOrigin attribute to every tile img element. Pass "anonymous" to make tile loads CORS-mode so canvas captures (map screenshots / html2canvas) can read the pixels. The tile host must answer with Access-Control-Allow-Origin or the tiles fail to load entirely — leave unset for hosts you don't control. "use-credentials" and "" are also valid. Construction-time only.
detectRetinaboolfalseIf true, request tiles at 2x resolution on hi-DPI displays (loads twice as many tiles but renders sharper).
errorTileUrlstringURL of an image shown in place of any tile that fails to load. A 1x1 transparent PNG data URL is the common "hide broken tiles" trick.
maxNativeZoomnumberMaximum zoom level that the tile source actually has tiles for. Leaflet upscales tiles from this zoom when the map zooms in past it (instead of 404-ing). Useful for overlays whose cache caps below the map's max zoom — e.g. USGS Hydro is only cached to z16; set maxNativeZoom=16 and the z16 tile will be shown at z17/z18.
maxZoomnumber19Maximum zoom level for this tile layer.
minZoomnumber0Minimum zoom level at which this tile layer is visible. Below this zoom Leaflet stops requesting tiles entirely (no 404 thrash on out-of-range historical / harbor-cropped pyramids). Default 0.
opacitynumber1Layer opacity, 0..1. [MUTABLE]
styledictInline style for the root element. For Map, this is where you set height.
subdomainsstring \list of stringSubdomains substituted into the URL {s} placeholder. Accepts an array like ['a','b','c'] or a string 'abc' (each character is a subdomain).
tmsboolfalseIf true, inverts Y coordinates so this layer works with TMS-shaped tile pyramids (Leaflet defaults to XYZ).
urlstring'https://tile.openstreetmap.org/{z}/{x}/{y}.png'Tile URL template, e.g. "https://tile.openstreetmap.org/{z}/{x}/{y}.png". Updating it swaps the basemap. [MUTABLE]
zIndexnumberExplicit z-index for the tile layer's DOM pane. Higher = renders on top. Useful when stacking multiple tile layers and DOM mount order alone is insufficient. [MUTABLE]

TileSelector

TileSelector adds a toggle button to the map. While active, the cursor becomes a crosshair, a dashed outline tracks the tile under the cursor at the current map zoom, and clicking a tile adds/removes it from the multi-select. Holding Shift while dragging captures every tile inside the resulting box. Selections persist across zooms (each tile is keyed by z/x/y). Place it as a child of dl2.Map.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
classNamestringOften-used CSS class name(s) for the root element.
hoverColorstring'#fa5252'Color of the hover outline.
positionstring'topleft'"topleft" \"topright" \"bottomleft" \"bottomright".
selectedColorstring'#228be6'Stroke + fill color of selected-tile rectangles (and the box-drag preview).
selectedTileslist of dict[]Currently selected tiles, each {z, x, y, url, bounds: [s, w, n, e]}. Two-way: clicks + shift-drag add/remove tiles (component → Python); Python callbacks can also push (e.g. a Clear button writes []). [MUTABLE]
styledictInline style for the root element. For Map, this is where you set height.
tileUrlstring'https://tile.openstreetmap.org/{z}/{x}/{y}.png'Tile URL template — same {s}/{z}/{x}/{y} form as a TileLayer URL.

Tooltip

Tooltip shows a small label on hover (or permanently), bound to its parent layer (Marker, Polygon, ...). Children render through a React portal, so any Dash component works as content. Wraps Leaflet 2's Tooltip.

proptypedefaultdescription
idstringThe ID used to identify this component in Dash callbacks.
childrennodeTooltip content — any Dash/HTML children, rendered live via a React portal.
classNamestringOften-used CSS class name(s) for the root element.
directionstring'auto'Placement: "right" \"left" \"top" \"bottom" \"center" \"auto".
opacitynumber0.9Tooltip opacity, 0..1.
permanentboolfalseIf true, the tooltip stays open instead of showing only on hover.
styledictInline style for the root element. For Map, this is where you set height.

Note for AI agents: This is the static, prerendered view of an interactive Dash application served because we detected a non-JS user agent. Full prose docs: