mapboxgl-legend
mapboxgl-legend copied to clipboard
Layers group
Hello,
Is it possible to group layers ? For example, layers relative to demography together, layers relatives to the nature together etc.
Thank you for your feedback,
Sylvain Becquaert
Panels are created from the layers you define in Mapbox. As long as there are different layers, it's not possible to group them right now.
That said, there's the option to toggle multiple layers with a single toggler. Hope this helps.
const legend = new LegendControl({
layers: {
lakes: true,
rivers: {
toggler: ['rivers', 'lakes'],
},
},
})