npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@topolyne/react

v0.3.2

Published

Beautiful, Terraink-inspired maps designed on topolyne.com, embedded with one React component.

Downloads

264

Readme

@topolyne/react

Beautiful, terrain-aware maps designed at topolyne.com, embedded in your React app with one component.

Design a map in the Topolyne editor, publish it, then drop it into your app:

npm install @topolyne/react
import { Map } from "@topolyne/react";

export default function Page() {
  return <Map mapId="map_Nvm9w6Wn9d" style={{ width: "100%", height: "500px" }} />;
}

mapId is the id you get back from Publish in the editor. The component fetches your published design, builds the matching MapLibre style (including terrain/contours when your design uses them), and stays in sync — change the design in the Topolyne dashboard and the embedded map updates without a redeploy.

Markers

Pins placed in the Topolyne editor (up to 20 per map) are baked into the published design and render automatically — you don't need any code for those, they show up the moment <Map> loads.

<MapMarker> is for markers you add at runtime that aren't part of the saved design — a user's current location, a search result, anything driven by your own app state:

import { Map, MapMarker } from "@topolyne/react";

<Map mapId="map_Nvm9w6Wn9d" style={{ width: "100%", height: "500px" }}>
  <MapMarker latitude={40.7128} longitude={-74.006} onClick={() => alert("Hi from NYC")} />
</Map>;

<MapMarker> must be rendered inside <Map>. Pass children to render your own marker element instead of the default pin.

Routes

import { Map, MapRoute } from "@topolyne/react";

<Map mapId="map_Nvm9w6Wn9d" style={{ width: "100%", height: "500px" }}>
  <MapRoute
    origin={[-5.9301, 54.5964]}
    destination={[-5.9081, 54.6031]}
    profile="foot-walking"
    onRoute={({ distanceMeters, durationSeconds }) => console.log(distanceMeters, durationSeconds)}
  />
</Map>;

<MapRoute> must be rendered inside <Map>. Draws a real routed path between two points (turn-by-turn directions, not a straight line), fetched through Topolyne's own backend so no routing API key ever reaches the browser. profile defaults to "driving-car""cycling-regular" and "foot-walking" are also available. waypoints adds stops in between. color/width style the line; onError fires if directions aren't configured on the backend.

Reading the underlying map instance

import { useTopolyneMap } from "@topolyne/react";

function FlyToButton() {
  const { map, loaded } = useTopolyneMap();
  if (!loaded) return null;
  return <button onClick={() => map?.flyTo({ center: [-0.1276, 51.5072], zoom: 12 })}>Fly to London</button>;
}

useTopolyneMap() must be called from a component rendered inside <Map>. It returns the live MapLibre GL Map instance once loaded, so you can drop down to the MapLibre API for anything this package doesn't wrap directly.

Props

| Prop | Type | Default | Description | | --- | --- | --- | --- | | mapId | string | — | The id from Publish in the Topolyne editor. Required. | | className | string | — | Applied to the map's wrapping div. | | style | CSSProperties | — | Applied to the map's wrapping div. The map has no intrinsic size — set a width and height here. | | center | [number, number] | published value | Override the saved center ([longitude, latitude]). | | zoom | number | published value | Override the saved zoom. | | pitch | number | published value | Override the saved pitch. | | bearing | number | published value | Override the saved bearing. | | interactive | boolean | true | Set false for a static, poster-style embed. | | onLoad | (map: maplibregl.Map) => void | — | Called once the map has loaded. | | provider | MapProviderConfig | — | Escape hatch for pointing tile/terrain sources at a self-hosted Topolyne instance. Most apps never set this. |

Self-hosting

import { configureTopolyne } from "@topolyne/react";

configureTopolyne({ apiBaseUrl: "https://your-topolyne-instance.com" });

Points the SDK at a different Topolyne instance — a local dev server while building against Topolyne itself, or a self-hosted deployment. Almost no app needs this; by default the SDK talks to https://topolyne.com.

Interacting with a published map

Middle-click-drag (or the equivalent touch gesture) tilts and rotates the map — the same affordance the Topolyne editor's own preview has. This is automatic on every interactive <Map>; there's no prop for it.

Requirements

  • React 18 or later (react and react-dom are peer dependencies)
  • A map published from topolyne.com

Attribution

<Map> shows a small attribution control automatically (© OpenMapTiles, © OpenStreetMap contributors, a Topolyne link) — this is legally required by OpenStreetMap's data license wherever the map is shown, so please don't remove or hide it.

License

MIT