⚠️ Early Stage Project: This library is not production-ready yet. Developers should use it with caution and expect breaking changes.

Reference

Complete reference for all map components and their props.

Tip: This library is built on top of Mapbox GL JS. Most components extend the native Mapbox options. Refer to the Mapbox Map API for additional configuration options.

Component Anatomy

All components you can use and combine to build your map.

<Map>
  {/* Markers */}
  <MapMarker coordinates={[lng, lat]}>
    <MarkerContent>
      <MarkerLabel />
    </MarkerContent>
    <MarkerPopup />
    <MarkerTooltip />
  </MapMarker>

  {/* Popup */}
  <MapPopup coordinates={[lng, lat]} />

  {/* Controls */}
  <MapControls position="bottom-right">
    <MapZoom />
    <MapOrientation />
    <MapGeolocate />
    <MapFullscreen />
  </MapControls>

  {/* Features */}
  <MapMiniMap />
  <MapLine coordinates={[[lng, lat], ...]} />
  <MapPolygon coordinates={[[lng, lat], ...]} />
  <MapLineAnimated id="route" path={[[lng, lat], ...]} />
  <MapLineRadial id="radial" origin={[lng, lat]} destinations={[[lng, lat], ...]} />
  <MapArcAnimated id="arc" origin={[lng, lat]} destination={[lng, lat]} />
  <MapAnimatedPolygon id="zone" coordinates={[[lng, lat], ...]} />
  <MapCircleCluster data={geoJsonData} />
  <MapAnimatedPulse id="pulse" size={100} coordinates={[lng, lat]} />
  <MapImage id="overlay" url="..." coordinates={[...]} />
  <MapRasterVideo id="video" urls={[...]} coordinates={[...]} />
  <MapBlurArea coordinates={[[lng, lat], ...]} />
  <MapRain />
</Map>

Map

The root container that initializes Mapbox GL and provides context to all child components. Automatically handles theme switching between light and dark modes.

Extends MapOptions from Mapbox GL (excluding container and style).

PropTypeDescription
accessTokenstringMapbox access token. Required.
childrenReactNodeChild components (markers, popups, controls, features).
center[number, number]Initial map center [longitude, latitude].
zoomnumberInitial zoom level.
bearingnumberMap bearing (rotation) in degrees.
pitchnumberMap pitch (tilt) in degrees.
projectionstringMap projection: mercator, globe, albers, equalEarth, equirectangular, lambertConformalConic, naturalEarth, winkelTripel.
stylestringMap style URL (e.g., 'mapbox://styles/mapbox/streets-v12'). Overrides theme-based styles.
stylesNewMapThemeStylesTheme-aware styles object. Use presets: defaultMapStyles, standardMapStyles, streetsMapStyles, outdoorsMapStyles, satelliteMapStyles, navigationMapStyles.
minZoomnumberMinimum zoom level constraint.
maxZoomnumberMaximum zoom level constraint.
maxBounds[[number, number], [number, number]]Restrict map panning to a geographic area [southwest, northeast].
loaderReactNodeCustom loading component shown while map initializes.
showLoaderNewbooleanControls loader visibility. When true, forces loader. When false, hides. When undefined, uses internal loading state.
autoRotateNewbooleanEnables automatic rotation. Only works with projection="globe".
rotateSpeedNewnumberRotation speed in degrees per second when autoRotate is enabled.

MapControls

Container for map control components. Accepts composable control components as children (MapZoom, MapOrientation, MapGeolocate, MapFullscreen). Must be used inside Map.

PropTypeDescription
position"top-left" | "top-right" | "bottom-left" | "bottom-right"Position of the controls on the map.
childrenReactNodeControl components (MapZoom, MapOrientation, MapGeolocate, MapFullscreen).
classNamestringAdditional CSS classes for the controls container.

MapZoom

Zoom in and zoom out control buttons. Must be used inside MapControls.

No props required.

MapOrientation

Compass control that shows map orientation and resets bearing to north when clicked. Must be used inside MapControls.

No props required.

MapGeolocate

Geolocate control to find and fly to user's current location. Must be used inside MapControls.

PropTypeDescription
onLocate(coords: { longitude: number; latitude: number }) => voidCallback with user coordinates when located.

MapFullscreen

Fullscreen toggle control. Must be used inside MapControls.

No props required.

MapMarker

A container for marker-related components. Provides context for its children and handles marker positioning.

Extends MarkerOptions from Mapbox GL (excluding element).

PropTypeDescription
coordinates[number, number]Coordinates [longitude, latitude] for marker position.
childrenReactNodeMarker subcomponents (MarkerContent, MarkerPopup, etc).
onClick(e: MouseEvent) => voidCallback when marker is clicked.
onMouseEnter(e: MouseEvent) => voidCallback when mouse enters marker.
onMouseLeave(e: MouseEvent) => voidCallback when mouse leaves marker.
onDragStart(lngLat: LngLatCoordinates) => voidCallback when marker drag starts (requires draggable: true).
onDrag(lngLat: LngLatCoordinates) => voidCallback during marker drag (requires draggable: true).
onDragEnd(lngLat: LngLatCoordinates) => voidCallback when marker drag ends (requires draggable: true).

MarkerContent

Renders the visual content of a marker. Must be used inside MapMarker. If no children provided, renders a default blue dot marker.

PropTypeDescription
childrenReactNodeCustom marker content. Defaults to a blue dot.
classNamestringAdditional CSS classes for the marker container.

MarkerPopup

Renders a popup attached to the marker that opens on click. Must be used inside MapMarker.

Extends PopupOptions from Mapbox GL (excluding className and closeButton).

The className and closeButton from Mapbox's PopupOptions are excluded to prevent style conflicts. Use the component's own props to style the popup. Mapbox's default popup styles are reset via CSS.
PropTypeDescription
childrenReactNodePopup content.
classNamestringAdditional CSS classes for the popup container.
closeButtonbooleanShow a close button in the popup.

MarkerTooltip

Renders a tooltip that appears on hover. Must be used inside MapMarker.

Extends PopupOptions from Mapbox GL (excluding className, closeButton, and closeOnClick as tooltips auto-dismiss on hover out).

The className from Mapbox's PopupOptions is excluded to prevent style conflicts. Use the component's own className prop to style the tooltip content. Mapbox's default popup styles are reset via CSS.
PropTypeDescription
childrenReactNodeTooltip content.
classNamestringAdditional CSS classes for the tooltip container.

MarkerLabel

Renders a text label above or below the marker. Must be used inside MarkerContent.

PropTypeDescription
childrenReactNodeLabel text content.
classNamestringAdditional CSS classes for the label.
position"top" | "bottom"Position of the label relative to the marker.

MapPopup

A standalone popup component that can be placed anywhere on the map without a marker. Must be used inside Map.

Extends PopupOptions from Mapbox GL (excluding className and closeButton).

The className and closeButton from Mapbox's PopupOptions are excluded to prevent style conflicts. Use the component's own props to style the popup. Mapbox's default popup styles are reset via CSS.
PropTypeDescription
coordinates[number, number]Coordinates [longitude, latitude] for popup position.
onClose() => voidCallback when popup is closed.
childrenReactNodePopup content.
classNamestringAdditional CSS classes for the popup container.
closeButtonbooleanShow a close button in the popup.

MapLine

Renders a line on the map connecting coordinate points. Must be used inside Map.

PropTypeDescription
coordinates[number, number][]Array of [longitude, latitude] coordinate pairs.
colorstringLine color (CSS color value).
widthnumberLine width in pixels.
opacitynumberLine opacity (0 to 1).
dashArray[number, number]Dash pattern [dash length, gap length] for dashed lines.

MapPolygonNew

Renders a filled polygon on the map. Must be used inside Map.

PropTypeDescription
coordinates[number, number][]Array of [longitude, latitude] coordinate pairs defining the polygon vertices.
fillColorstringFill color of the polygon.
fillOpacitynumberFill opacity (0 to 1).
strokeColorstringStroke/outline color.
strokeWidthnumberStroke width in pixels.
strokeOpacitynumberStroke opacity (0 to 1).
dashArray[number, number]Dash pattern [dash length, gap length] for dashed strokes.

MapCircleCluster

Renders clustered point data using Mapbox GL's native clustering. Automatically groups nearby points into clusters that expand on click. Must be used inside Map. Supports a generic type parameter for typed feature properties: MapCircleCluster<MyProperties>.

PropTypeDescription
datastring | GeoJSON.FeatureCollectionGeoJSON FeatureCollection data or URL to fetch GeoJSON from.
clusterMaxZoomnumberMaximum zoom level to cluster points on.
clusterRadiusnumberRadius of each cluster when clustering points (in pixels).
clusterColors[string, string, string]Colors for cluster circles: [small, medium, large] based on point count.
clusterThresholds[number, number]Point count thresholds for color/size steps: [medium, large].
pointColorstringColor for unclustered individual points.
onPointClick(feature: GeoJSON.Feature, coordinates: [number, number]) => voidCallback when an unclustered point is clicked.
onClusterClick(clusterId: number, coordinates: [number, number], pointCount: number) => voidCallback when a cluster is clicked. If not provided, zooms into the cluster.

MapAnimatedPulse

Renders an animated pulsing dot at specified coordinates. Must be used inside Map.

PropTypeDescription
idstringUnique identifier for the pulse animation.
sizenumberPulse size in pixels.
coordinates[number, number]Coordinates [longitude, latitude] for pulse position.
colorstringInner circle color.
pulseColorstringOuter pulsing circle color.
durationnumberAnimation duration in milliseconds.

MapAnimatedPolygonNew

Renders an animated polygon with drawing outline and fill effects. Must be used inside Map.

PropTypeDescription
idstringUnique identifier for the polygon.
coordinates[number, number][]Array of [longitude, latitude] pairs defining polygon vertices.
strokeColorstringColor of the polygon outline.
strokeWidthnumberWidth of the polygon outline in pixels.
strokeOpacitynumberOpacity of the polygon outline (0-1).
fillColorstringColor of the polygon fill.
fillOpacitynumberTarget opacity of the polygon fill (0-1).
durationnumberDuration of outline drawing animation in milliseconds.
fillDurationnumberDuration of fill animation in milliseconds.
animationMode"draw" | "fill" | "draw-then-fill"Animation sequence mode.
autoStartbooleanStart animation automatically on mount.
loopbooleanLoop the animation continuously.
loopDelaynumberDelay before restarting loop in milliseconds.
onDrawComplete() => voidCallback when outline drawing completes.
onFillComplete() => voidCallback when fill animation completes.
onComplete() => voidCallback when entire animation completes.

MapMiniMapUpdated

Displays an overview minimap showing the current viewport context. Must be used inside Map.

PropTypeDescription
position"top-left" | "top-right" | "bottom-left" | "bottom-right"Position of the minimap on the map.
widthnumberMinimap width in pixels.
heightnumberMinimap height in pixels.
zoomOffsetnumberZoom offset relative to main map.
stylestringCustom map style URL for the minimap. Overrides theme-based styles.
stylesNewMapThemeStylesTheme-aware styles object with light/dark variants. Automatically switches based on theme.
boxColorstringColor of the viewport box outline.
boxBorderWidthnumberWidth of the viewport box border.
roundedNewnumber | "full" | "none"Border radius in pixels, "full" for circular, or "none".
draggableNewbooleanAllow users to drag the minimap anywhere within the map.

MapBlurAreaNew

Renders blur effect overlays on specified areas of the map. Supports single or multiple areas. Must be used inside Map.

PropTypeDescription
coordinates[number, number][]Array of [longitude, latitude] coordinate pairs defining a single blur area.
areasBlurAreaConfig[]Array of blur area configs for multiple regions. Each config: { coordinates, blur?, backgroundColor?, rounded? }.
blurnumberDefault blur intensity in pixels.
backgroundColorstringDefault background color overlay (e.g., "rgba(0,0,0,0.3)").
roundednumber | "full"Default border radius in pixels or "full" for circular.
blockInteractionbooleanPrevent map interactions on blur areas.

MapLineAnimated

Renders an animated line that draws progressively along the route. Must be used inside Map.

PropTypeDescription
idstringUnique identifier for the animated line.
pathArray<[number, number]>Array of [longitude, latitude] coordinate pairs.
colorstringLine color.
widthnumberLine width in pixels.
opacitynumberLine opacity (0 to 1).
dashArray[number, number]Dash pattern [dash length, gap length] for dashed lines.
durationnumberAnimation duration in milliseconds.
showMarkerbooleanWhether to show a marker moving along the line.
markerColorstringMarker color.
markerIconReactNodeCustom marker icon (React component).
markerBorderlessbooleanRemove border/outline from marker.
autoStartbooleanAuto-start animation on mount.
loopbooleanLoop animation continuously.
onComplete() => voidCallback when animation completes.

MapLineRadialNew

Renders animated curved lines spreading from a central origin to multiple destinations. Must be used inside Map.

PropTypeDescription
idstringUnique identifier for the radial lines.
origin[number, number]Origin coordinates [longitude, latitude].
destinationsRadialDestination[]Array of destinations. Each can be [lng, lat] or { coordinates, color?, label? }.
colorstringDefault line color.
widthnumberLine width in pixels.
opacitynumberLine opacity (0 to 1).
dashArray[number, number]Dash pattern [dash length, gap length] for dashed lines.
curvaturenumber | "auto"Curve intensity (0-1) or "auto" to calculate based on distance.
curveSegmentsnumberNumber of segments for smooth curves.
durationnumberAnimation duration per line in milliseconds.
staggerDelaynumberDelay between starting each line animation.
autoStartbooleanStart animation automatically on mount.
loopbooleanLoop the animation continuously.
loopDelaynumberDelay before restarting loop in milliseconds.
showOriginMarkerbooleanShow marker at origin point.
originMarkerColorstringOrigin marker color.
originMarkerIconReactNodeCustom origin marker icon.
originMarkerPulsebooleanShow pulse animation on origin marker.
showDestinationMarkersbooleanShow markers at destination points.
destinationMarkerColorstringDestination marker color (defaults to line color).
destinationMarkerIconReactNodeCustom destination marker icon.
showTravelingMarkerbooleanShow marker traveling along the active line.
travelingMarkerColorstringTraveling marker color (defaults to line color).
travelingMarkerIconReactNodeCustom traveling marker icon.
onLineComplete(index: number, destination: [number, number]) => voidCallback when a line animation completes.
onComplete() => voidCallback when all line animations complete.

MapArcAnimatedNew

Renders an animated curved arc between two points. Useful for visualizing flights, deliveries, and point-to-point connections. Must be used inside Map.

PropTypeDescription
idstringUnique identifier for the arc.
origin[number, number]Starting point coordinates [longitude, latitude].
destination[number, number]Ending point coordinates [longitude, latitude].
colorstringArc line color.
widthnumberLine width in pixels.
opacitynumberLine opacity (0 to 1).
dashArray[number, number]Dash pattern [dash length, gap length] for dashed arcs.
heightnumberCurve height multiplier (0 = straight line, higher = more curved).
segmentsnumberNumber of segments for curve smoothness.
durationnumberAnimation duration in milliseconds.
autoStartbooleanStart animation automatically on mount.
loopbooleanLoop the animation continuously.
loopDelaynumberDelay before restarting loop in milliseconds.
showMarkerbooleanShow traveling marker at the arc tip during animation.
markerColorstringTraveling marker color (defaults to arc color).
showOriginMarkerbooleanShow marker at the origin point.
originMarkerColorstringOrigin marker color (defaults to arc color).
showDestinationMarkerbooleanShow marker at destination when animation completes.
destinationMarkerColorstringDestination marker color (defaults to arc color).
onComplete() => voidCallback when animation completes.

MapCompareUpdated

Displays two maps side-by-side for visual comparison. This component creates its own map instances and does not require a parent Map component.

PropTypeDescription
accessTokenstringMapbox access token. Required.
beforeStylestringMap style for the before (left/top) map.
afterStylestringMap style for the after (right/bottom) map.
center[number, number]Initial map center [longitude, latitude].
zoomnumberInitial zoom level.
bearingnumberMap bearing (rotation) in degrees.
pitchnumberMap pitch (tilt) in degrees.
projection"globe" | "mercator" | "naturalEarth" | "equalEarth" | "winkelTripel"Map projection type.
defaultSizenumberInitial split position as percentage (0-100).
orientationNew"horizontal" | "vertical"Compare layout direction. Horizontal shows left/right, vertical shows top/bottom.
showLabelsNewbooleanShow Before/After or Top/Bottom labels on each map panel.
loaderReactNodeCustom loading component.

MapImage

Overlays an image on the map at specified coordinates. Must be used inside Map.

PropTypeDescription
idstringUnique identifier for the image layer.
urlstringImage URL to display.
coordinates[[number, number], [number, number], [number, number], [number, number]]Four corner coordinates [topLeft, topRight, bottomRight, bottomLeft] as [lng, lat] pairs.
opacitynumberImage opacity (0 to 1).

MapRasterVideo

Overlays video content on the map at specified coordinates. Must be used inside Map.

PropTypeDescription
idstringUnique identifier for the video layer.
urlsstring[]Array of video URLs (provide multiple formats for browser compatibility).
coordinates[[number, number], [number, number], [number, number], [number, number]]Four corner coordinates [topLeft, topRight, bottomRight, bottomLeft] as [lng, lat] pairs.
opacitynumberVideo opacity (0 to 1).
autoplaybooleanAuto-play video on load.
loopbooleanLoop video playback.
mutedbooleanMute video audio.

MapRain

Adds an animated rain weather effect overlay to the map. Requires Mapbox GL JS v3.9 or higher. Must be used inside Map.

This component requires Mapbox GL JS v3.9+. Use the createZoomInterpolation helper to create zoom-based effects.
PropTypeDescription
densitynumber | any[]Rain density (0-1) or Mapbox expression for zoom-based density.
intensitynumberRain intensity (0-1).
colorstringRain droplet color.
opacitynumberRain opacity (0-1).
vignettenumber | any[]Vignette effect strength (0-1) or Mapbox expression.
vignetteColorstringVignette color.
direction[number, number]Wind direction [x, y].
dropletSize[number, number]Droplet size range [min, max].
distortionStrengthnumberDistortion strength (0-1).
centerThinningnumberCenter thinning effect (0 = full screen).

MarkerAvatar

Renders an avatar image with optional status indicator. Must be used inside MarkerContent.

PropTypeDescription
srcstringImage source URL.
altstringAlt text for the image.
sizenumberSize of the avatar in pixels.
onlinebooleanShow online status indicator.
statusColor"green" | "red" | "yellow" | "blue"Status indicator color.
classNamestringAdditional CSS classes for the avatar container.

Helper Functions

createZoomInterpolation

Creates a Mapbox zoom-based interpolation expression for dynamic effects. Useful for rain density and vignette that scale with zoom level.

import { Map, MapRain, createZoomInterpolation } from "@/registry/map";

export function RainMapExample() {
  // Gradually increase rain density from zoom 11 to 13
  const density = createZoomInterpolation(0.8, 11, 13);
  const vignette = createZoomInterpolation(0.5, 11, 13);

  return (
    <Map
      accessToken={process.env.NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN!}
      center={[-74.006, 40.7128]}
      zoom={12}
    >
      <MapRain
        density={density}
        vignette={vignette}
        intensity={1.0}
        color="#a8adbc"
      />
    </Map>
  );
}