API

api description comes here

The following additional props are supported:

Prop

Type

Description

onClick?

LeafletMouseEventHandlerFn

Fired when the user clicks (or taps) the cluster.

onDblClick?:

LeafletMouseEventHandlerFn

Fired when the user double-clicks (or double-taps) the cluster.

onMouseDown?:

LeafletMouseEventHandlerFn

Fired when the user pushes the mouse button on the cluster.

onMouseUp?:

LeafletMouseEventHandlerFn

Fired when the user releases the mouse button pushed on the cluster.

onMouseOver?:

LeafletMouseEventHandlerFn

Fired when the mouse enters the cluster.

onMouseOut?:

LeafletMouseEventHandlerFn

Fired when the mouse leaves the cluster.

onContextMenu?:

LeafletMouseEventHandlerFn

Fired when the user right-clicks on the cluster, prevents default browser context menu from showing if there are listeners on this event. Also fired on mobile when the user holds a single touch for a second (also called long press).

showCoverageOnHover?

boolean

When you mouse over a cluster it shows the bounds of its markers.

zoomToBoundsOnClick?

boolean

When you click a cluster we zoom to its bounds.

spiderfyOnMaxZoom?

boolean

When you click a cluster at the bottom zoom level we spiderfy it so you can see all of its markers.

removeOutsideVisibleBounds?

boolean

Clusters and markers too far from the viewport are removed from the map for performance.

animate?

boolean

Smoothly split / merge cluster children when zooming and spiderfying. If L.DomUtil.TRANSITION is false, this option has no effect (no animation is possible).

animateAddingMarkers?

boolean

If set to true (and animate option is also true) then adding individual markers to the MarkerClusterGroup after it has been added to the map will add the marker and animate it into the cluster. Defaults to false as this gives better performance when bulk adding markers. addLayers does not support this, only addLayer with individual Markers.

disableClusteringAtZoom?

boolean

If set, at this zoom level and below markers will not be clustered. This defaults to disabled.

maxClusterRadius

number | ((zoom: number) => number)

The maximum radius that a cluster will cover from the central marker (in pixels). Default 80. Decreasing will make more, smaller clusters. You can also use a function that accepts the current map zoom and returns the maximum cluster radius in pixels

polygonOptions?

PolylineOptions

Options to pass when creating the L.Polygon(points, options) to show the bounds of a cluster.Defaults to empty

singleMarkerMode?

boolean

If set to true, overrides the icon for all added markers to make them appear as a 1 size cluster.

spiderLegPolylineOptions?

PolylineOptions

Allows you to specify PolylineOptions to style spider legs. By default, they are { weight: 1.5, color: '#222', opacity: 0.5 }.

spiderfyDistanceMultiplier?

number

Increase from 1 to increase the distance away from the center that spiderfied markers are placed.Use if you are using big marker icons (Default: 1).

iconCreateFunction?

((cluster: MarkerCluster) => Icon | DivIcon)

Function used to create the cluster icon

chunkedLoading?

boolean

Boolean to split the addLayers processing in to small intervals so that the page does not freeze.

chunkDelay?

number

Time delay (in ms) between consecutive periods of processing for addLayers. Default to 50ms.

chunkInterval?

number

Time interval (in ms) during which addLayers works before pausing to let the rest of the page process.In particular, this prevents the page from freezing while adding a lot of markers. Defaults to 200ms.

chunkProgress?

(processedMarkers: number, totalMarkers: number, elapsedTime: number) => void

Callback function that is called at the end of each chunkInterval. Typically used to implement a progress indicator. Defaults to null.

Sources: https://github.com/Leaflet/Leaflet.markercluster/blob/master/src/MarkerClusterGroup.js https://github.com/Leaflet/Leaflet.markercluster#all-options

Last updated