Leaflet embeds pan-zoom maps in web pages with markers, vector layers, and controls. It targets browsers with a small footprint and an extension plugin ecosystem.
Overview
Leaflet is a JavaScript mapping library for adding interactive maps to websites. You attach a map to a page element, load tile layers such as OpenStreetMap-backed rasters, then stack markers, popups, and vector geometry on top. The design favors a focused core rather than bundling every GIS feature upfront.
Core capabilities include tile and WMS layers, markers with popups and tooltips, polylines, polygons, circles, GeoJSON, and image or SVG overlays. Interaction covers smooth panning, multiple zoom gestures, pointer modalities, draggable markers, and standard on-map controls for zoom, layers, scale, attribution, and fullscreen modes.
Rendering uses GPU-assisted pan and zoom where available, with SVG or Canvas vectors clipped and simplified during movement. Maps resize with their container, support fractional zoom levels, and remain sharp on high-DPI displays. Customization relies on CSS styling, HTML markers, and optional non-geographic projections for floor plans or game boards.
For developers, the project distributes tree-shakable ES modules, ships TypeScript types, avoids runtime dependencies, and documents an event model on maps and layers. Accessibility features include keyboard navigation, labeled controls, and screen-reader-friendly popups, with translatable built-in strings.
Key features
- Tile layers and WMS support
- Markers, popups, and tooltips
- Polylines, polygons, and GeoJSON
- Touch, mouse, and pen interaction
- GPU-assisted pan and zoom
- Layer and attribution controls
- Plugin extension model
- TypeScript types and ES modules
Use cases
- Embedding location maps in web applications
- Plotting GeoJSON feature collections
- Building dashboards with draggable markers
- Non-geographic canvases such as floor plans