# Leaflet — card for AI agents

Lightweight JavaScript library for creating mobile-friendly interactive maps.

Category: 3D and graphics · npm package `leaflet` · latest version 1.9.4 (checked 2026-11-01)
Install: `npm install leaflet`
License: BSD-2-Clause (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## 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.

## What it is
- Leaflet is an open-source JavaScript library for interactive maps. The GitHub repo was created on 2010-09-22 and is BSD-2-Clause licensed. The README credits Volodymyr Agafonkin as the creator. The website says Leaflet "is now developed by a big community of contributors".
- The basic flow is short. You create a map in a page element and add tiles from a URL template. Then you put markers, popups, vector shapes, image overlays or GeoJSON on top. The two official pages give slightly different size figures. The README says "about 40 kB of gzipped JS plus 3.2 kB of gzipped CSS". The website says "about 42 KB of JS" and does not say whether that figure is gzipped.
- The maintainers write that it "works efficiently across all major desktop and mobile platforms". They are open about its scope: the site says Leaflet "doesn't try to do everything for everyone". When a feature seems to be missing, the site advises checking for a plugin first. The homepage also shows a list of company and organisation names under the heading "Trusted by the best". The site does not say how these names use Leaflet.

## Caveats
- Latest GitHub release dates from May 2023: 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.
- Homepage opens on a 2.0 alpha: 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.
- Missing features: plugins first, then issues: 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.

## Numbers (AgentGid data)
- Gid Score: 76.1 (#176 of all tools, 3 of 63 in its category)
- Used in 95 public projects set up for AI coding agents (1.5%)
- Downloads last week: 11,894,459 (as of 2026-11-24), +44.8% over 4 weeks
- GitHub stars: 45,978 (as of 2026-11-24)
- Last push: 2026-11-23

## Often used with
React Leaflet 61.1%, Tailwind CSS 89.5%, Lucide React 67.4%, Tailwind Merge 64.2%, Class Variance Authority 58.9%, clsx 64.2%

## Checked alternatives (same job)
- Mapbox GL: https://agentgid.com/tools/mapbox-gl/agent.md
- MapLibre GL: https://agentgid.com/tools/maplibre-gl/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/leaflet/
- Homepage: https://leafletjs.com/
- Repository: https://github.com/Leaflet/Leaflet
- Source: https://github.com/Leaflet/Leaflet#readme
- Source: https://github.com/Leaflet/Leaflet
- Source: https://github.com/Leaflet/Leaflet/releases
- Source: https://leafletjs.com

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
