API Reference

Complete reference for all map components and their props.

Note: This library is built on top of MapLibre GL JS . Most components extend the native MapLibre options. Refer to the MapLibre Map API for additional options not listed here.

Component Anatomy

All parts of the component you can combine to build your map.

<Map>
  <MapMarker :longitude="..." :latitude="...">
    <MarkerContent>
      <MarkerLabel />
    </MarkerContent>
    <MarkerPopup />
    <MarkerTooltip />
  </MapMarker>

  <MapPopup :longitude="..." :latitude="..." />
  <MapControls />
  <MapRoute :coordinates="..." />
  <MapArc :data="..." />
  <MapClusterLayer :data="..." />
</Map>

Map

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

Native MapLibre MapOptions (excluding container and style) flow through $attrs — pass them as regular Vue attributes (e.g. :scroll-zoom="false").

PropTypeDefaultDescription
default slotVNode[]Child components (markers, popups, controls, routes).
classstringAdditional CSS classes for the map container.
theme"light" | "dark"Theme for the map. If not provided, automatically detects from .dark/.light class on <html> or system preference.
styles{ light?: string | StyleSpecification; dark?: string | StyleSpecification }Custom map styles for light and dark themes. Overrides default Carto basemap tiles.
projectionProjectionSpecificationMap projection type. Use { type: "globe" } for 3D globe view.
viewportPartial<MapViewport>Controlled viewport state. Use with v-model:viewport (or :viewport + @update:viewport) to drive the map state.
@update:viewport(viewport: MapViewport) => voidEmitted continuously as the viewport changes (during pan, zoom, rotate). Use as event listener or pair with :viewport via v-model.
loadingbooleanfalseShow a loading indicator on the map.
...$attrsMapOptionsNative MapLibre options (center, zoom, scrollZoom, dragPan, ...) flow through $attrs to the underlying Map constructor.

useMap

A composable that provides access to the MapLibre map instance and loading state. Must be used within a Map component.

const { map, isLoaded } = useMap();

Returns map (a MapLibre.Map Ref) and isLoaded (boolean Ref) which is true once the map is ready.

MapControls

Renders map control buttons (zoom, compass, locate, fullscreen). Must be used inside Map.

PropTypeDefaultDescription
position"top-left" | "top-right" | "bottom-left" | "bottom-right""bottom-right"Position of the controls on the map.
showZoombooleantrueShow zoom in/out buttons.
showCompassbooleanfalseShow compass button to reset bearing.
showLocatebooleanfalseShow locate button to find user's location.
showFullscreenbooleanfalseShow fullscreen toggle button.
classstringAdditional CSS classes for the controls container.
@locate(coords: { longitude: number; latitude: number }) => voidEmitted with the user's coordinates when located.

MapMarker

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

Native MapLibre MarkerOptions (excluding element) flow through $attrs.

PropTypeDefaultDescription
longitudenumberLongitude coordinate for marker position.
latitudenumberLatitude coordinate for marker position.
default slotVNode[]Marker subcomponents (MarkerContent, MarkerPopup, MarkerTooltip, MarkerLabel).
@click(e: MouseEvent) => voidEmitted when marker is clicked.
@mouseenter(e: MouseEvent) => voidEmitted when mouse enters the marker.
@mouseleave(e: MouseEvent) => voidEmitted when mouse leaves the marker.
@dragstart(lngLat: { lng, lat }) => voidEmitted when marker drag starts (requires draggable: true).
@drag(lngLat: { lng, lat }) => voidEmitted during marker drag (requires draggable: true).
@dragend(lngLat: { lng, lat }) => voidEmitted when marker drag ends (requires draggable: true).

MarkerContent

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

PropTypeDefaultDescription
default slotVNode[]Custom marker content. Defaults to a blue dot if no slot content is provided.
classstringAdditional 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 MapLibre GL (excluding className and closeButton).

The className and closeButton from MapLibre's PopupOptions are excluded to prevent style conflicts. Use the component's own props to style the popup. MapLibre's default popup styles are reset via CSS.
PropTypeDefaultDescription
default slotVNode[]Popup content.
classstringAdditional CSS classes for the popup container.
closeButtonbooleanfalseShow a close button in the popup.

MarkerTooltip

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

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

PropTypeDefaultDescription
default slotVNode[]Tooltip content.
classstringAdditional CSS classes for the tooltip container.

MarkerLabel

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

PropTypeDefaultDescription
default slotVNode[]Label text content.
classstringAdditional CSS classes for the label.
position"top" | "bottom""top"Position of the label relative to the marker.

MapPopup

A standalone popup component placed at any coordinate without a marker. Must be used inside Map.

PropTypeDefaultDescription
longitudenumberLongitude coordinate for popup position.
latitudenumberLatitude coordinate for popup position.
@close() => voidEmitted when the popup is closed.
default slotVNode[]Popup content.
classstringAdditional CSS classes for the popup container.
closeButtonbooleanfalseShow a close button in the popup.

MapRoute

Renders a line/route on the map connecting coordinate points. Must be used inside Map. Supports click and hover for building route-selection UIs.

PropTypeDefaultDescription
idstringautoOptional unique identifier for the route layer. Auto-generated if not provided.
coordinates[number, number][]Array of [longitude, latitude] coordinate pairs.
colorstring"#4285F4"Line color (CSS color value).
widthnumber3Line width in pixels.
opacitynumber0.8Line opacity (0 to 1).
dashArray[number, number]Dash pattern [dash length, gap length] for dashed lines.
@click() => voidEmitted when the route line is clicked.
@mouseenter() => voidEmitted when mouse enters the route line.
@mouseleave() => voidEmitted when mouse leaves the route line.
interactivebooleantrueWhether the route is interactive (shows pointer cursor on hover).

MapArc

Renders curved lines between coordinate pairs using a quadratic Bézier in longitude/latitude space. Must be used inside Map.

Built on a MapLibre line layer — the paint and layout props accept any field from LineLayerSpecification.

Style per arc with a MapLibre expression as any paint value. Reference fields on each datum with ["get", "fieldName"].

PropTypeDefaultDescription
dataMapArcDatum[]Arcs to render. Each needs a unique id and from / to as [lng, lat]. Extra fields forwarded to feature properties.
idstringautoId prefix for the underlying source/layers.
curvaturenumber0.2How far the arc bows away from a straight line. 0 = straight, higher = more bend, negative = opposite side.
samplesnumber64Points per arc. Higher = smoother.
paintLineLayerSpecification['paint']{ "line-color": "#4285F4", "line-width": 2, "line-opacity": 0.85 }Paint props merged over defaults. Values may be MapLibre expressions for per-feature styling.
layoutLineLayerSpecification['layout']{ "line-join": "round", "line-cap": "round" }Layout props merged over defaults.
hoverPaintLineLayerSpecification['paint']Paint overrides applied to the hovered arc via feature-state.
@click(e: MapArcEvent) => voidEmitted when an arc is clicked.
@hover(e: MapArcEvent | null) => voidEmitted when the hovered arc changes. Receives null when the cursor leaves all arcs.
interactivebooleantrueRespond to mouse events (hover, cursor, callbacks).
beforeIdstringInsert the arc layers before this layer id.

MapClusterLayer

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

PropTypeDefaultDescription
datastring | GeoJSON.FeatureCollectionGeoJSON FeatureCollection or URL to fetch GeoJSON from.
clusterMaxZoomnumber14Maximum zoom level to cluster points on.
clusterRadiusnumber50Radius of each cluster in pixels.
clusterColors[string, string, string]["#22c55e", "#eab308", "#ef4444"]Colors for cluster circles: [small, medium, large] based on point count.
clusterThresholds[number, number][100, 750]Point count thresholds for color/size steps: [medium, large].
pointColorstring"#3b82f6"Color for unclustered individual points.
manualClusterClickbooleanfalseWhen true, suppresses the default zoom behavior on cluster click — only the @clusterClick event is emitted.
@pointClick(feature: GeoJSON.Feature, coordinates: [number, number]) => voidEmitted when an unclustered point is clicked.
@clusterClick(clusterId: number, coordinates: [number, number], pointCount: number) => voidEmitted when a cluster is clicked. If no listener is bound (or manualClusterClick is false), the cluster auto-zooms.