New advertisers: 50% off your first month with code FIRSTMONTHSee slots
mapbox avatar

Mapbox Web Integration Patterns

Integration patterns for Mapbox GL JS across React, Vue, Svelte, and Angular, with lifecycle and cleanup guidance.

skills.sh installs
2.7K
GitHub stars
87
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers setup, token handling, Search JS integration, and version requirements for GL JS v3.x and framework versions
  • Includes React patterns using useRef and useEffect, with Search JS SearchBox wiring and a Vite-based token example
  • Enforces calling map.remove() on cleanup and initializing maps outside render to avoid leaks and infinite loops
  • Designed for developers integrating Mapbox GL JS into React, Vue, Svelte, Angular, or Next.js apps

Install

$ npx -y skills add mapbox/mapbox-agent-skills --skill mapbox-web-integration-patterns -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Mapbox Integration Patterns Skill

This skill provides official patterns for integrating Mapbox GL JS into web applications using React, Vue, Svelte, Angular, and vanilla JavaScript. These patterns are based on Mapbox's create-web-app scaffolding tool and represent production-ready best practices.

Version Requirements

Mapbox GL JS

Recommended: v3.x (latest)

  • Minimum: v3.0.0
  • Why v3.x: Modern API, improved performance, active development
  • v2.x: Legacy; no longer actively developed (see migration notes below)

Installing via npm (recommended for production):

npm install mapbox-gl@^3.0.0    # Installs latest v3.x

CDN (for prototyping only):

<!-- Replace VERSION with latest v3.x from https://docs.mapbox.com/mapbox-gl-js/ -->
<script src="https://api.mapbox.com/mapbox-gl-js/vVERSION/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/vVERSION/mapbox-gl.css" rel="stylesheet" />

Framework Requirements

Details

Repository
github.com/mapbox/mapbox-agent-skills
Category
Frontend & UI Code
First seen
Apr 16, 2026

More from mapbox/mapbox-agent-skills

All 18

Similar to Mapbox Web Integration Patterns

More Frontend & UI Code