Description
svelte-mapbox is a set of Mapbox map and geocoding autocomplete components for Svelte. It also works in vanilla JavaScript. The map is the container component, and other components, such as markers, sit on top of it. By default markers are map pins that take a color property, and you can pass a custom pin through the default slot. Clicking a pin opens a popup that shows the text in the label property, and you can turn the popup off or pass a custom DOM element. The map has reactive properties for center and zoom, so changes you make are reflected on the map, and bound variables update when the user moves or zooms. Methods are queued because rendering a map is expensive. The package says it is SvelteKit ready and SSR ready, and that the map has no client-side dependencies. The geocoder adds a client-side dependency of about 0.5 MB to the bundle. The code is public on GitHub.…
Highlights
- Mapbox map container and marker components for Svelte
- Geocoding autocomplete component
- Custom marker pins and popups
- Reactive center and zoom properties
- SvelteKit and SSR ready
Ratings & Reviews
No ratings yet
Be the first to rate Svelte Mapbox.
People also visit
Svelte Mapbox FAQ
What is svelte-mapbox?
A set of Svelte components for Mapbox maps, markers and geocoding autocomplete, which also work in vanilla JavaScript.
Does it work with SvelteKit?
Yes. The README says it is SvelteKit ready and SSR ready.
Does the geocoder add weight?
Yes. The README says the geocoder adds about 0.5 MB to the bundle and slows the build when bundled.
How do I customize markers?
Use the color property for standard pins, or the default slot for a custom pin. Popups can be turned off or replaced with a custom element.
What are the best Svelte Mapbox alternatives?
Popular alternatives to Svelte Mapbox include Flutter Maplibre and Motion Core. See all Svelte Mapbox alternatives















