Leaflet components bindings for Svelte !
Install svelte-leaflet with your favorite package manager
npm install @kayoshi-dev/svelte-leaflet leaflet
[!NOTE]
This is still a WIP. API might change.
import { MapContainer, Marker, TileLayer } from '@kayoshi-dev/svelte-leaflet';
For the moment only three components are available :
This is the main component that will help you create your interactive map.
All the other components should be used inside the body of that component.
[!IMPORTANT]
Must be used with thecomponent!
Usage :
<MapContainer center={[48, 2.34]}>
</MapContainer>
This component allows you to define the tile layer you would like to use.
Usage :
<MapContainer center={[48, 2.34]}>
<TileLayer attribution="© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors" url="https://tile.openstreetmap.org/{z}/{x}/{y}.png" />
</MapContainer>
Add one or multiple markers on your map
Usage :
<Marker latlng={[48, 2.34]} popupText={'Hello world!'} markerOptions={{ draggable: true }} />