Skip to main content

CnWidgetMapViewer

CnWidgetMapViewer is the built-in v2 widget that exposes the CnMapWidget map primitive to the manifest layer.

Note: this widget wraps CnMapWidget (the primitive) — not CnMapPage. The page shell (header, filters, list pane) isn't appropriate inside a widget slot, so the manifest layer dispatches the naked map primitive directly.

Import

import { CnWidgetMapViewer } from '@conduction/nextcloud-vue'

Manifest usage

Referenced via widgetKey: "map-viewer":

{
"id": "sources-map",
"slot": "body",
"widgetKey": "map-viewer",
"gridWidth": 8,
"gridHeight": 6,
"props": {
"markers": [
{ "id": "1", "lat": 52.37, "lng": 4.89, "label": "NL endpoint" }
],
"zoom": 8
}
}

gridHeight matters here — maps need a defined height to render the Leaflet canvas; the default 12-column grid row height typically needs 4–8 rows for a usable map.

Props

Forwarded to CnMapWidget. The commonly used ones:

PropTypeDescription
markersArrayMarker records { id, lat, lng, label?, popup? }.
zoomNumberInitial zoom level.
centerObject{ lat, lng } center; default [0, 0].
layersArrayAdditional tile / overlay layer configurations ({ id, type, url, opacity, attribution }).
clusteringBooleanGroup nearby markers into clusters via leaflet.markercluster. Defaults true once a threshold is reached.
autoFitBooleanAutomatically fit the map bounds to the marker set on mount. Defaults true.

See CnMapWidget for the complete surface.

Spec

  • REQ-MVR-009 (manifest-v2-renderer) — built-in widget: map-viewer