This is a sample project using Svelte that shows how to add a Control to MapLibre GL JS. demo
pnpm add xiupos/maplibre-gl-sample-svelte-control
// 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);
});
This project is based on the MapLibre GL JS documentation and the Svelte documentation.
This project is licensed under the MIT License.