Skip to content
Make with

maplibre-react-components

Lightweight MapLibre React bindings

Maintained by Pentatrion

maplibre-react-components offers a lightweight, focused approach to React-MapLibre integration. It provides essential React components for MapLibre with minimal overhead, making it ideal for projects that need simple, efficient MapLibre integration.

Quick start

npm install maplibre-react-components maplibre-gl@5
import 'maplibre-gl/dist/maplibre-gl.css';
import { RMap } from 'maplibre-react-components';

export default function App() {
  return (
    <RMap
      style={{ minHeight: 400 }}
      initialCenter={[0, 20]}
      initialZoom={2}
      mapStyle="https://tiles.openfreemap.org/styles/liberty"
    />
  );
}
Runs this code in your browser, in a new tab.
›Setup noteschecked with v0.2.6

Version 0.2 has a peer dependency of maplibre-gl ^5.0.0, so install MapLibre GL JS v5 and skip setWorkerUrl. RMap fills its parent, so give it or its parent a height. Props that only apply when the map is created start with initial (initialCenter, initialZoom); mapStyle can change later.

Other platforms are on SDKs.