# πΊοΈ Vue-Leaflet v2 Wrapper
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href] \
[![Vue][vue-src]][vue-href]
[![Leaflet][leaflet-src]][leaflet-href]
A modern Vue 3 wrapper for Leaflet v2-alpha, based on [vue-leaflet/vue-leaflet](https://github.com/vue-leaflet/vue-leaflet). Built with the Composition API, fully SSR-compatible, and designed for future extensibility.
> β οΈ This is a **Beta version** and may be unstable. Contributions, feedback, and bug reports are welcome via [issues](https://github.com/Maxel01/vue-leaflet/issues) or [discussions](https://github.com/Maxel01/vue-leaflet/discussions).
> β
Fully compatible with SSR (tested in Nuxt playground)
---
## π What's New
- β
Leaflet v2-alpha support
- β
Refactored with Vue 3 Composition API
- β
SSR compatibility without `useGlobalLeaflet`
- β
>95% test coverage
- β
Improved documentation ([vue-leaflet-docs](https://maxel01.github.io/vue-leaflet/))
- β
Component playground for live demos
- β
Plugin support via [vue-leaflet-plugins](https://github.com/Maxel01/vue-leaflet-plugins)
---
## β
Available Components
βοΈ LCircle
βοΈ LCircleMarker
βοΈ LControl
βοΈ LControlAttribution
βοΈ LControlLayers
βοΈ LControlScale
βοΈ LControlZoom
βοΈ LFeatureGroup
βοΈ LGeoJson
βοΈ LIcon
βοΈ LImageOverlay
βοΈ LMap
βοΈ LMarker
βοΈ LPolygon
βοΈ LPolyline
βοΈ LPopup
βοΈ LRectangle
βοΈ LSVGOverlay
βοΈ LTileLayer
βοΈ LTooltip
βοΈ LVideoOverlay
βοΈ LWmsTileLayer
---
## π Plugin Support
Leaflet plugins compatible with version 2 can be seamlessly integrated using a dedicated wrapper: \
π [vue-leaflet-plugins](https://github.com/Maxel01/vue-leaflet-plugins)
Explore the documentation to see which plugins are already supported and learn how to build your own wrappers for additional functionality.
The first plugin has already been implemented. If you need support for a specific plugin, open an issue in the plugin repo and help shape the roadmap.
> β οΈ **Important:** Leaflet v1 plugins are **not compatible** with Leaflet v2 and cannot be used directly. To use a plugin with v2, it must be ported and wrapped appropriately. \
> However, there is a possibility to use the [Leaflet-V1-polyfill](https://github.com/Falke-Design/Leaflet-V1-polyfill). Check out the [`vue-leaflet-plugins`](https://github.com/Maxel01/vue-leaflet-plugins) wrapper for more.
---
## π¦ Installation
```bash
pnpm add @maxel01/vue-leaflet leaflet@2.0.0-alpha
# or
yarn add @maxel01/vue-leaflet leaflet@2.0.0-alpha
# or
npm i @maxel01/vue-leaflet leaflet@2.0.0-alpha
```
---
## π§βπ» Usage
Check out the full documentation at [vue-leaflet-docs](https://maxel01.github.io/vue-leaflet/) or explore the [playground](https://github.com/Maxel01/vue-leaflet/tree/master/playground/app/pages).
Most props mirror the vanilla [Leaflet options](https://leafletjs.com/reference-2.0.0.html) for a familiar experience.
### β‘ Quickstart
```vue
```
---
## π§ͺ Interactive Playground
Unlock the full potential of **vue-leaflet** with interactive demo components built right into the [official documentation](https://maxel01.github.io/vue-leaflet/). The playground lets you explore real-world examples, experiment with features live, and see how everything fits together.
Want to test **Server-Side Rendering (SSR)**? Dive into the **Nuxt playground** for a hands-on SSR experience.
To run the **Nuxt Playground** locally:
```bash
git clone https://github.com/maxel01/vue-leaflet.git
cd vue-leaflet
pnpm install
pnpm dev
```
Visit: [http://127.0.0.1:3000](http://127.0.0.1:3000)
Or use the Vue-specific playground:
```bash
pnpm dev:vue
```
Visit: [http://127.0.0.1:5173](http://127.0.0.1:5173)
---
## π Contribution
This repo uses `pnpm` for building and development.
> π [How to install PNPM](https://pnpm.io/installation)
See the [contribution guide](https://maxel01.github.io/vue-leaflet/getting-started/contribution.html) for more.
---
## π Credits
- [vue-leaflet/vue-leaflet](https://github.com/vue-leaflet/vue-leaflet)
- [nuxt-modules/leaflet](https://github.com/nuxt-modules/leaflet)
[npm-version-src]: https://img.shields.io/npm/v/@maxel01/vue-leaflet/latest.svg?color=0F81C2
[npm-version-href]: https://www.npmjs.com/package/@maxel01/vue-leaflet
[npm-downloads-src]: https://img.shields.io/npm/dm/@maxel01/vue-leaflet.svg
[npm-downloads-href]: https://www.npmjs.com/package/@maxel01/vue-leaflet
[license-src]: https://img.shields.io/npm/l/@maxel01/vue-leaflet.svg
[license-href]: https://www.npmjs.com/package/@maxel01/vue-leaflet
[vue-src]: https://img.shields.io/npm/dependency-version/@maxel01/vue-leaflet/peer/vue?label=Vue&logo=vue.js&colorA=18181B
[vue-href]: https://vuejs.org
[leaflet-src]: https://img.shields.io/npm/dependency-version/@maxel01/vue-leaflet/peer/leaflet?label=Leaflet&logo=leaflet&colorA=18181B
[leaflet-href]: https://leafletjs.com/