Skip to content

Maxel01/vue-leaflet

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—ΊοΈ Vue-Leaflet v2 Wrapper

npm version npm downloads License
Vue Leaflet

A modern Vue 3 wrapper for Leaflet v2-alpha, based on 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 or 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)
  • βœ… Component playground for live demos
  • βœ… Plugin support via 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

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. Check out the vue-leaflet-plugins wrapper for more.


πŸ“¦ Installation

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 or explore the playground.

Most props mirror the vanilla Leaflet options for a familiar experience.

⚑ Quickstart

<script setup>
import 'leaflet/dist/leaflet.css'
import { LMap, LTileLayer } from '@maxel01/vue-leaflet'
import { ref } from 'vue'

const zoom = ref(2)
</script>

<template>
  <div style="height:600px; width:800px">
    <LMap v-model:zoom="zoom" :center="[47.41322, -1.219482]">
      <LTileLayer
        url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
        layer-type="base"
        name="OpenStreetMap"
      />
    </LMap>
  </div>
</template>

πŸ§ͺ Interactive Playground

Unlock the full potential of vue-leaflet with interactive demo components built right into the official documentation. 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:

git clone https://github.com/maxel01/vue-leaflet.git
cd vue-leaflet
pnpm install
pnpm dev

Visit: http://127.0.0.1:3000

Or use the Vue-specific playground:

pnpm dev:vue

Visit: http://127.0.0.1:5173


πŸ›  Contribution

This repo uses pnpm for building and development.

πŸ“˜ How to install PNPM

See the contribution guide for more.


πŸ™Œ Credits

About

vue-leaflet compatible with vue3

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 66.9%
  • Vue 32.9%
  • Other 0.2%