Skip to content

Latest commit

 

History

History
62 lines (48 loc) · 967 Bytes

README.md

File metadata and controls

62 lines (48 loc) · 967 Bytes

solidjs-leaflet

A simple SolidJS wrapper for leaflet to display maps.

Installation

npm install solidjs-leaflet leaflet
yarn add solidjs-leaflet leaflet
pnpm add solidjs-leaflet leaflet

If you are using Typescript, also install:

npm install -D @types/leaflet
yarn add -D @types/leaflet
pnpm add -D @types/leaflet

Usage

To use the SolidJS leaflet wrapper:

import {SolidLeafletMap} from "solidjs-leaflet"

const Example = () => {
  return (
    <SolidLeafletMap
      center={[63.0, 13.0]}
      id="map"
      zoom={17}
      onMapReady={(l, m) => {
        const icon = l.icon({
          iconUrl: '/marker-icon.png',
          shadowUrl: '/marker-shadow.png',
        });
        const marker = l
          .marker([63.0 13.0], {
            icon,
          })
          .addTo(m);
        marker.bindPopup('Hello World!');
      }}
    />
  );
};