{"id":13701551,"url":"https://github.com/CliffCloud/Leaflet.EasyButton","last_synced_at":"2025-05-04T21:31:02.981Z","repository":{"id":38627488,"uuid":"19722536","full_name":"CliffCloud/Leaflet.EasyButton","owner":"CliffCloud","description":"leaflet control buttons with icons and callbacks","archived":false,"fork":false,"pushed_at":"2024-02-22T12:44:05.000Z","size":4226,"stargazers_count":534,"open_issues_count":24,"forks_count":123,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-27T19:06:23.873Z","etag":null,"topics":["buttons","javascript","leaflet","map"],"latest_commit_sha":null,"homepage":"http://cliffcloud.github.io/Leaflet.EasyButton/v1/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CliffCloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-05-13T02:05:25.000Z","updated_at":"2025-03-27T21:28:54.000Z","dependencies_parsed_at":"2024-06-18T12:26:09.632Z","dependency_job_id":null,"html_url":"https://github.com/CliffCloud/Leaflet.EasyButton","commit_stats":{"total_commits":118,"total_committers":25,"mean_commits":4.72,"dds":0.5084745762711864,"last_synced_commit":"cd53db586a10d5a9c4efed003327cad29f4760bf"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CliffCloud%2FLeaflet.EasyButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CliffCloud%2FLeaflet.EasyButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CliffCloud%2FLeaflet.EasyButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CliffCloud%2FLeaflet.EasyButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CliffCloud","download_url":"https://codeload.github.com/CliffCloud/Leaflet.EasyButton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252403868,"owners_count":21742456,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["buttons","javascript","leaflet","map"],"created_at":"2024-08-02T20:01:48.311Z","updated_at":"2025-05-04T21:31:02.326Z","avatar_url":"https://github.com/CliffCloud.png","language":"JavaScript","readme":"# L.EasyButton\n\nThe easiest way to add buttons with Leaflet \u0026mdash; so simple it fits in a gif:\n\n![running demo](https://raw.githubusercontent.com/CliffCloud/Leaflet.EasyButton/dist/img/alert_example.gif)\n\n### More [running examples and docs](http://danielmontague.com/projects/easyButton.js/v2/examples/)\n\n-----------------------------------------------------------------------------------\n\n## Boilerplate Examples\n\nThese use `YOUR_LEAFLET_MAP` as a placeholder;\nremember to change it to the variable name of your map.\n\n##### Hello World\n\nopen a popup\n\n```javascript\nvar helloPopup = L.popup().setContent('Hello World!');\n\nL.easyButton('fa-globe', function(btn, map){\n    helloPopup.setLatLng(map.getCenter()).openOn(map);\n}).addTo( YOUR_LEAFLET_MAP );\n```\n\n##### Map State\n\nset the map's center and use an `img` for the icon\n\n```javascript\nL.easyButton('\u003cimg src=\"/path/to/img/of/penguin.png\"\u003e', function(btn, map){\n    var antarctica = [-77,70];\n    map.setView(antarctica);\n}).addTo( YOUR_LEAFLET_MAP );\n```\n\n##### Button States\n\nchange the button's function and appearance\n\n```javascript\nvar stateChangingButton = L.easyButton({\n    states: [{\n            stateName: 'zoom-to-forest',        // name the state\n            icon:      'fa-tree',               // and define its properties\n            title:     'zoom to a forest',      // like its title\n            onClick: function(btn, map) {       // and its callback\n                map.setView([46.25,-121.8],10);\n                btn.state('zoom-to-school');    // change state on click!\n            }\n        }, {\n            stateName: 'zoom-to-school',\n            icon:      'fa-university',\n            title:     'zoom to a school',\n            onClick: function(btn, map) {\n                map.setView([42.3748204,-71.1161913],16);\n                btn.state('zoom-to-forest');\n            }\n    }]\n});\n\nstateChangingButton.addTo( YOUR_LEAFLET_MAP );\n```\n\n-----------------------------------------------------------------------------------\n\n## Download/Install\n\nEasyButton version `2.x.x` and up expect Leaflet `1.x.x` or higher;\nfor Leaflet `0.7.x` use EasyButton `1.3.x`.\n\n### jsDelivr\n\n```\n\u003clink rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.css\"\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.js\"\u003e\u003c/script\u003e\n```\n\n### NPM\n\n```\nnpm install --save leaflet-easybutton\n```\n\n### Bower\n\n```\nbower install --save Leaflet.EasyButton\n```\n\n### Icon Dependencies\n\nIf you haven't already, make sure to install/include the icon library of your\nchoice (your lib should have its own instructions)\n\u0026mdash; EasyButton should work with anything!\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCliffCloud%2FLeaflet.EasyButton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCliffCloud%2FLeaflet.EasyButton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCliffCloud%2FLeaflet.EasyButton/lists"}