This is a map with overlays and a markercluster

In this example we use a MarkerCluster overlay to group the markers instead of a LayerGroup. The layer is defined as any other overlay. The possible options can be found in the MarkerCluster docs

Layer definition:

cars: {
    name: 'Cars',
    type: 'markercluster',
    visible: true
}
                

The MarkerCluster, at this moment, does not support the location change of the markers and they have to be removed and added again to the cluster. So, as we remove & add markers when the model is changed, you can experience a slight glitch during this operation. You can test it clicking the button below.