nuxt-mapbox
Elegant Mapbox GL JS integration with Nuxt
223,383
| Install | |
|---|---|
npm install nuxt-mapbox |
|
| Latest Version: | 1.6.4 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Sep 12, 2025 |
| Links: | npm |
Maintainer: alexlavoie42
Nuxt-Mapbox
Elegant Mapbox integration with Nuxt
📖 Check out the new docs!
Features
- 🏗 Easily add Mapbox to your Nuxt app with Vue components
- 🌎 useMapbox Composable for easy access
- 👷 defineMapboxMarker & defineMapboxPopup for making custom components
- 🎛️ defineMapboxControl for creating your own controls
- 📖 Persistent map instances across routes
Quick Setup
- Add
nuxt-mapbox&mapbox-gldependencies to your project
npx nuxi@latest module add nuxt-mapbox
npm install --save-dev mapbox-gl
- Add
nuxt-mapboxto themodulessection ofnuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-mapbox'
]
})
- Add your Mapbox API key to the
mapboxsection ofnuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-mapbox'
],
mapbox: {
accessToken: '{API_KEY}'
}
})
Usage
View the Mapbox GL JS Docs for reference.
Map instances are created with components. You can provide all the options through component props
Example:
<MapboxMap
map-id="{ID}"
style="position: absolute; top: 0; bottom: 0; left: 250px; width: 500px;"
:options="{
style: 'mapbox://styles/mapbox/light-v11', // style URL
center: [-68.137343, 45.137451], // starting position
zoom: 5 // starting zoom
}"
/>
You can add Layers, Sources & Controls by nesting their respective components inside the Map
Examples:
<MapboxMap
...
>
<MapboxSource
source-id="{ID}"
:source="{
type: 'geojson',
data: '/test.geojson'
}"
/>
<MapboxLayer
:layer="{
source: '{ID}',
id: 'geojson-layer',
type: 'fill'
}"
/>
<MapboxGeolocateControl position="top-left" />
</MapboxMap>
Development
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release
Related Packages
nuxt-maptiler-gl
Nuxt module for vue3-maptiler-gl — auto-import components, composables, CSS, and...
664
0
nuxt-maplibre-gl
Nuxt module for vue3-maplibre-gl — auto-import components, composables, CSS, and...
1,053
6
nuxt-easy-lightbox
A plugin to the simple Vue 3 Image Lightbox component with Zoom / Drag / Rotate...
131,938
Version History
| Version | Released | License |
|---|---|---|
| 1.6.4 | MIT | |
| 1.6.3 | MIT | |
| 1.6.2 | MIT | |
| 1.6.1 | MIT | |
| 1.6.0 | MIT | |
| 1.5.9 | MIT | |
| 1.5.8 | MIT | |
| 1.5.7 | MIT | |
| 1.5.6 | MIT | |
| 1.5.5 | MIT | |
| 1.5.4 | MIT | |
| 1.5.3 | MIT | |
| 1.5.2 | MIT | |
| 1.5.1 | MIT | |
| 1.5.0 | MIT | |
| 1.4.5 | MIT | |
| 1.4.4 | MIT | |
| 1.4.3 | MIT | |
| 1.4.2 | MIT | |
| 1.4.1 | MIT | |
| 1.4.0 | MIT | |
| 1.3.9 | MIT | |
| 1.3.8 | MIT | |
| 1.3.7 | MIT | |
| 1.3.6 | MIT | |
| 1.3.5 | MIT | |
| 1.3.4 | MIT | |
| 1.3.3 | MIT | |
| 1.3.2 | MIT | |
| 1.3.1 | MIT |
Showing the latest 30 of 46. See every release on npm
Pre-releases (71)
| Version | Released | License |
|---|---|---|
| 1.6.4-dev.0 | MIT | |
| 1.6.3-dev.0 | MIT | |
| 1.6.2-dev.0 | MIT | |
| 1.6.1-dev.0 | MIT | |
| 1.6.0-dev.2 | MIT | |
| 1.6.0-dev.1 | MIT | |
| 1.6.0-dev.0 | MIT | |
| 1.5.10-dev.3 | MIT | |
| 1.5.10-dev.2 | MIT | |
| 1.5.10-dev.1 | MIT | |
| 1.5.10-dev.0 | MIT | |
| 1.5.9-dev.1 | MIT | |
| 1.5.8-dev.0 | MIT | |
| 1.5.4-dev.1 | MIT | |
| 1.5.4-dev.0 | MIT | |
| 1.5.3-dev.1 | MIT | |
| 1.5.3-dev.0 | MIT | |
| 1.5.2-dev.0 | MIT | |
| 1.5.1-dev.1 | MIT | |
| 1.5.0-dev.4 | MIT | |
| 1.5.0-dev.3 | MIT | |
| 1.5.0-dev.2 | MIT | |
| 1.5.0-dev.1 | MIT | |
| 1.5.0-dev.0 | MIT | |
| 1.4.5-1 | MIT | |
| 1.4.5-dev.0 | MIT | |
| 1.4.2-dev.0 | MIT | |
| 1.4.1-dev.0 | MIT | |
| 1.4.0-dev.11 | MIT | |
| 1.4.0-dev.10 | MIT |
Showing the latest 30 of 71. See every release on npm