Skip to content
 
 

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leaflet-legend

This is a simple legend plugin for Leaflet. It can be used to add a small popup legend to a Leaflet map, demo

What is this?

This plugin allows you to add a simple popup legend to a Leaflet map. It extends the Leaflet Control class: creating and positioning the necessary container elements.

Example

After including leaflet-legend.js and leaflet-legend.css in your project, you can add a legend to your map with the following:

L.control.legend({
    items: [
        {color: 'red', label: 'reserved'},
        {color: 'blue', label: 'not reserved'}
    ],
    collapsed: true,
    // insert different label for the collapsed legend button.
    buttonHtml: 'legend'
}).addTo(map);

The complete example can be found in example.html.

Dependencies

  • Leaflet 1.3.1

Install

Install with npm:

npm install git@github.com:zostera/leaflet-legend.git

or fork the github project.

License

MIT License

About

A Leaflet plugin for adding a popup legend to a map

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages