
SolidJS MapLibre
SolidJS components for MapLibre GL JS
Maintained by Sergey Shishkin
Solid-MapLibre wraps MapLibre GL JS in SolidJS components: a Map component that takes MapLibre's own options, plus sources, layers, markers, popups, and controls. It is written in TypeScript, uses MapLibre's native typings, and supports MapLibre GL JS v6.
Quick start
npm install solid-maplibre maplibre-glimport { Map } from "solid-maplibre";
import { setWorkerUrl } from "maplibre-gl";
import workerUrl from "maplibre-gl/dist/maplibre-gl-worker.mjs?worker&url";
import "maplibre-gl/dist/maplibre-gl.css";
// MapLibre GL JS v6 + a bundler: set the worker URL once (Vite shown)
setWorkerUrl(workerUrl);
export default function App() {
return (
<Map
style={{
width: "100%",
"aspect-ratio": "calc(16/9)",
}}
options={{
center: [0, 20],
style: "https://tiles.openfreemap.org/styles/liberty",
zoom: 2,
}}
/>
);
}›Setup noteschecked with v0.5.0
The README documents the MapLibre v6 worker setup, shown here for Vite. Its v6 typing updates are on the main branch but not yet in an npm release after 0.5.0, so a TypeScript project may need skipLibCheck until the next release. Import maplibre-gl.css yourself, and size the container through style, class, or classList.
Other platforms are on SDKs.