Leaflet
Lightweight JavaScript library for creating mobile-friendly interactive maps.
3. Used by agents' projects
Dependency in 95 public GitHub projects set up for AI coding agents that we scanned (1.5%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error
What Leaflet does
Leaflet's site says it "doesn't try to do everything for everyone" and instead focuses on "making the basic things work perfectly". The project currently sits between a v1.9.4 release from 2023 and a 2.0 alpha that the website already leads with.
Leaflet popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How Leaflet is used
- Leaflet is a dependency in 95 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (2.0% of the 4,867 JavaScript/TypeScript ones), #2 of 63 in 3d and graphics.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 250; those are left out of every share on this page.
- The most used alternative in our scan is Mapbox GL (24 projects).
- Projects that use it most often also use React Leaflet (61.1%), Tailwind CSS (89.5%), Lucide React (67.4%).
By coding agent
Often used with
Leaflet in practice
Strengths
Under "Misc", the website's feature list says Leaflet is "Extremely lightweight" and has "No external dependencies".
The site lists several layer types "out of the box": tile layers, WMS, markers, popups, polylines, polygons, circles, rectangles, image overlays and GeoJSON.
The site lists these interaction features: drag panning with inertia, scroll-wheel zoom, pinch-zoom on mobile, double-click zoom, shift-drag zoom to area, keyboard navigation, click and pointer events, and marker dragging.
The site says polyline and polygon rendering uses "dynamic clipping and simplification", which it says "makes it very fast". It also lists a modular build for leaving out unused features, and tap delay elimination on mobile.
Watch out for
The latest GitHub release is v1.9.4, published 2023-05-18. It was a bug-fix release, with fixes such as tile gaps in Chromium-based browsers.
The website's first line says Leaflet 2.0.0-alpha.1 "has been released" and gives the date August 16, 2025. None of the sources here give release notes for the alpha, so what changed from 1.9.4 is not stated.
If a feature is missing, the site's advice is to check for a plugin and search past GitHub issues first. Only after that should you open a new GitHub issue.
Homepage example: OpenStreetMap tiles and a marker with a popup
import {LeafletMap, TileLayer, Marker} from 'leaflet';
const map = new LeafletMap('map').setView([51.505, -0.09], 13);
new TileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
new Marker([51.5, -0.09]).addTo(map)
.bindPopup('A pretty CSS popup.<br> Easily customizable.')
.openPopup();More about Leaflet
Funding
- GitHub Sponsors: https://github.com/Leaflet
- Open Collective: https://opencollective.com/leafletjs
- 19 GitHub sponsors
Packages around it
- react-leaflet: React bindings for Leaflet
- lucide-react: Icon components
- tailwindcss: Utility-first CSS
- tailwind-merge: Tailwind class merging
- clsx: Class name joining
- class-variance-authority: Component style variants
Alternatives
Leaflet This page
WebGL-based interactive maps library for rendering vector tiles and geospatial data.
Open-source WebGL interactive maps library with BSD license and community support.
Get started
Install it.
npm install leafletRules for your agent
## Leaflet
- Create the map in an existing container element (the docs use a `'map'` div), then call `setView` with a center and a zoom level.
- These layers come with core "out of the box": tile layers, WMS, markers, popups, polylines, polygons, circles, rectangles, image overlays and GeoJSON.
- Restyle popups and controls through CSS, which the docs describe as "Pure CSS popups and controls for easy restyling".
- For custom behaviour, use the docs' "simple interface for custom map layers and controls", or extend existing classes with the OOP facilities the docs list.
- If a feature is missing from core, look for an existing plugin and search GitHub issues before opening a new issue.