maplibre-gl-sample-svelte-control Svelte Themes

Maplibre Gl Sample Svelte Control

Sample project using Svelte that adds a Control to MapLibre GL JS

maplibre-gl-sample-svelte-control

This is a sample project using Svelte that shows how to add a Control to MapLibre GL JS. demo

Installation

pnpm add xiupos/maplibre-gl-sample-svelte-control

Usege

// Import the plugin
import { SampleControl } from 'maplibre-gl-sample-svelte-control';
import 'maplibre-gl-sample-svelte-control/dist/style.css';

// const map = new Map({ ... });

map.on('load', () => {
  // Add sample control
  const Sample = new SampleControl({ text: 'Custom text' });
  map.addControl(Sample);
});

Credits

This project is based on the MapLibre GL JS documentation and the Svelte documentation.

License

This project is licensed under the MIT License.

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes