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

@nuvui/map

v0.1.2

Published

A map for @nuvui/react, on MapLibre: markers and popups that are React elements, and controls drawn with the library's own buttons. It needs map tiles from a provider you choose.

Readme

@nuvui/map

A map for @nuvui/react, on MapLibre.

This is early: the package is on npm as a 0.x version, and before 1.0 a minor version may rename or remove things. The changelog says where one does, and the repository README says where things stand.

pnpm add @nuvui/map maplibre-gl @nuvui/react
"use client";

import "@nuvui/react/styles.css";
import "@nuvui/map/styles.css";
import { MapControls, MapMarker, MapView, setMapWorkerUrl } from "@nuvui/map";

// Where MapLibre's worker is. This is how Next.js and webpack are asked.
// With Vite, import the file with `?url` at the end and pass what you get.
setMapWorkerUrl(
  new URL("maplibre-gl/dist/maplibre-gl-worker.mjs", import.meta.url),
);

export function Office() {
  return (
    <MapView
      aria-label="Where the office is"
      mapStyle="https://tiles.example.com/styles/streets.json"
      defaultCenter={[13.405, 52.52]}
      defaultZoom={12}
    >
      <MapMarker
        position={[13.405, 52.52]}
        label="Berlin office"
        popup="Friedrichstraße 68, open nine to five"
      />
      <MapControls />
    </MapView>
  );
}

Say where the worker is

MapLibre does its work in a worker, which is a file of its own, and looks for it beside itself. A bundler leaves nothing beside it, so a bundled app calls setMapWorkerUrl once, before a map is drawn, with the address its bundler gives maplibre-gl/dist/maplibre-gl-worker.mjs. Without it the map stays on "Loading map". The docs have it for Next.js and for Vite.

You bring the map

A map is drawn from tiles, and tiles are served by someone. This package has no tiles and no provider: mapStyle takes the address of a MapLibre style, or the style itself, and whoever serves it is your provider. That's a choice with a cost, in money or in a server of your own, and with terms about how their names are shown. The names are drawn on the map from what the style says, at every width.

A reader's browser asks the provider for the tiles, so the provider sees their address and what they looked at. Say so where you say such things.

What's in it

  • MapView: the map. defaultCenter and defaultZoom are where it begins, or bounds an area to show all of. center and zoom move it when they change, and onMove says where it is.
  • MapMarker: a place on it, drawn as a pin or as what you give it. It has a name that's read in place of the drawing. With popup it's a button that opens one, and with draggable it's moved by pointer or by the arrow keys.
  • MapPopup: a box that points at a place, for one that no marker opens.
  • MapControls: buttons to zoom, to turn north back up, to go to where the reader is and to fill the screen. They're the core's buttons.
  • MapRoute: a line through a list of places, solid or in dashes, in the theme's colors. It draws a way and doesn't find one: the places come from you.
  • MapClusters: many places, gathered into one button with a number on it where they're near each other. A press zooms in to where they come apart, and only what's in view is on the page.
  • mapBoundsOf: the area that holds a list of places, for "show all of these".
  • useMap: the MapLibre map itself, for layers, sources and events the props don't cover.

How it behaves

The map is one stop for the Tab key: the arrow keys move it, and plus and minus zoom it. Each marker that does something is a button and a stop of its own, in the order they're written.

Until the style has come the box says the map is loading, and where the browser can't draw a map, which needs WebGL, it says so and onError is called.

In a page that scrolls, cooperativeGestures leaves the wheel and one finger to the page.

MapLibre is loaded when a map is first drawn, and not before, so a server renders the box and no map. It's about 235 kB compressed, and its worker another 120 kB. The rest of this package is about 6 kB.

Dependencies

@nuvui/react is a peer dependency: the controls are its buttons, and the map is drawn with its tokens.

The map is drawn by MapLibre GL JS, which is BSD-3-Clause. It's a peer dependency as well, version 6.4.1 or newer: you install it, so its worker is a file your app can reach, and its security fixes are yours to take when they come. Its stylesheet isn't needed: the rules of it that a map can't do without are in this package's, in the library's colors.

It's a package of its own so that an app with no map doesn't install one.

The docs are at https://nuvui.nuvraxis.com/docs/map.

License

MIT