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

react-route-profile

v0.1.42

Published

React component that renders a Google Map route with an interactive elevation profile.

Readme

react-route-profile

React component that renders a Google Map route with an interactive elevation profile.

Route map with elevation profile

Installation

npm install react-route-profile
# or
yarn add react-route-profile
# or (preferred)
bun add react-route-profile

Quick start

import { RouteMap } from "react-route-profile";
import type { RouteConfig } from "react-route-profile";

const apiKey = process.env.VITE_GOOGLE_MAPS_API_KEY || "";

const myRoute: RouteConfig = {
  id: "01",
  name: "Sample route",
  center: { lat: 48.9, lng: 20.5 },
  zoomHorizontal: 14,
  zoomVertical: 12,
  geoJson: myGeoJsonObject,
  surface: [{ segment: [0, 1000], type: "asphalt" }],
  routes: [{ id: "A12", color: "green", segment: [0, 1000] }],
};

<RouteMap apiKey={apiKey} route={myRoute} height="100dvh" lang="en" />;

Precompute elevation offline

bunx fetch-elevation --in path/to/route.geojson --out path/to/route.elevation.json --samples 200 --key $GOOGLE_MAPS_API_KEY
# - Elevation API must be enabled for this key
# - Omit --out to overwrite the input file with elevationProfile
# - Pass the output json to RouteConfig

Customization

Custom theme

import type { Theme } from "react-route-profile";

const myTheme: Theme = {
  colors: {
    primary: "rgba(14, 165, 233, 1)",
    primaryMuted: "rgba(14, 165, 233, 0.7)",
    accent: "rgba(132, 204, 22, 1)",
    surface: "rgba(248, 250, 252, 1)",
  },
};

<RouteMap apiKey={apiKey} route={myRoute} theme={myTheme} lang="en" />;

Sticky header sizing

import { useMapHeader } from "react-route-profile";

const {
  refHeader,
  mapHeight,
} = useMapHeader();

<header ref={refHeader}>Header</header>
<div style={{ height: mapHeight }}>
  <RouteMap apiKey={apiKey} route={myRoute} height={mapHeight} lang="en" />
</div>;

API

RouteMap props

| Prop | Type | Description | | --------- | ---------------------- | ------------------------------------------------------ | | apiKey | string | Required Google Maps JS API key. | | route | RouteConfig | Route data (center, zooms, geoJson). | | height | number | string | Map height (e.g., 520 or "100dvh"). | | className | string | Optional wrapper class. | | style | CSSProperties | Inline style overrides. | | theme | Theme | Optional theme override (colors, marker/dots, layout). | | lang | "de" \| "en" \| "sk" | Optional UI language for built-in labels. |

RouteConfig

| Field | Type | Description | | -------------- | ----------------------------------------------------------------- | -------------------------------------------- | | id | string | Identifier for the route. | | name | string | Display name. | | center | { lat: number; lng: number } | Map center. | | zoomHorizontal | number (optional) | Zoom when landscape. | | zoomVertical | number (optional) | Zoom when portrait. | | geoJson | FeatureCollection | GeoJSON geometry and features. | | surface | Array<{ segment: [number, number]; type: SurfaceType }> | Optional surface segments for the strip. | | routes | Array<{ id: string; color: string; segment: [number, number] }> | Optional route segments for the route strip. |

Theme

| Field | Type | Description | | ------------------- | ------ | --------------------------------------- | | colors.primary | string | Main accent color. | | colors.primaryMuted | string | Softer variant of the primary. | | colors.accent | string | Secondary/accent color for labels. | | colors.surface | string | Background for loader/surfaces. | | marker | object | Marker palette (outer/inner/start/end). | | dots | object | Hover/line dot colors. | | map | object | Map stroke/marker sizing. | | chart | object | Chart spacing/strokes/ticks. | | tooltip | object | Tooltip background/text/padding. | | markerShape | object | Marker icon/label sizing/offsets. |

useMapHeader

Returns helpers to size the map below a sticky header:

  • refHeader: attach to your header element.
  • headerHeight: measured header height (px), 0 until ready.
  • isHeaderReady: true once the header is measured.
  • mapHeight: string/number height you can pass to RouteMap.

Notes

  • Requires a valid Google Maps JavaScript API key with Maps JavaScript enabled.
  • Provide geoJson as a FeatureCollection including your route geometry and optional point features for start/finish markers.