World Map (Choropleth) for React
A React choropleth world map and bubble map on the Equal Earth projection, with no map library. Pass data as readonly WorldMapDatum[]: values by country (choropleth), or bubble sizes at each country's centre (mode="bubble").
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/geo-map.jsonRevenue by country
WorldMapWorldMapTabledefaultWorldMapLabels- +1 more
Choropleth map in React
Revenue by country on a single-hue scale, light to dark. One market dwarfs the rest, so scaleType="log" spreads the others across the ramp. Switch the measure: the map cross-fades to the new colors and the headline rolls to the new total. Hover a country, or focus the map and use the arrow keys; ⌘/Ctrl + scroll, pinch or the buttons zoom.
Revenue by country
Last 12 months, 45 markets
import { ChartCard } from "@/components/sheenui/charts/chart-parts/chart-card";
import { WorldMap } from "@/components/sheenui/charts/geo-map";
import { WorldMapTable } from "@/components/sheenui/charts/geo-map/table";
import { NumberTicker } from "@/components/sheenui/number-ticker/number-ticker";
import { useToast } from "@/components/sheenui/toast/toast";
// Package build (after the first npm release, or a packed tarball): import { useToast, ChartCard, NumberTicker, WorldMapTable, WorldMap } from "@sheenui/theme";
// This example also uses number-ticker, toast: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/number-ticker.json https://lokendra-builds.github.io/sheenui/r/toast.json
const revenue = [
{ id: "US", value: 4_820_000 },
{ id: "GB", value: 1_240_000 },
{ id: "DE", value: 948_000 },
{ id: "IN", value: 538_000 },
// … any ISO 3166-1 code: "IN", "IND" or "356"
];
const total = revenue.reduce((sum, d) => sum + (d.value ?? 0), 0);
const usd = new Intl.NumberFormat("en", { style: "currency", currency: "USD", notation: "compact", maximumFractionDigits: 1 });
const toast = useToast(); // inside your component
<ChartCard
title="Revenue by country"
description="Last 12 months"
aside={<NumberTicker value={total} format={{ style: "currency", currency: "USD", notation: "compact", maximumFractionDigits: 1 }} />}
table={<WorldMapTable data={revenue} valueLabel="Revenue" format={usd.format} share />}
>
<WorldMap
data={revenue}
scaleType="log" // one market dwarfs the rest: spread them on a log scale
valueLabel="Revenue"
format={usd.format}
onSelect={(country) => toast.info(country.name, country.value === null ? "No data" : usd.format(country.value))}
aria-label="Revenue by country, last 12 months"
/>
</ChartCard>Diverging scale
Growth sits around a meaningful middle, so scale="diverging" uses two hues that meet at a neutral midpoint (0% here): orange for shrinking markets, blue for growing ones. The scale is symmetric, so equal changes get equally strong colors.
Year-over-year change in active users
2026 against 2025, by country
import { WorldMap } from "@/components/sheenui/charts/geo-map";
import { type WorldMapDatum } from "@/components/sheenui/charts/geo-map/types";
// Package build (after the first npm release, or a packed tarball): import { WorldMap, type WorldMapDatum } from "@sheenui/theme";
const signedPercent = new Intl.NumberFormat("en", { style: "percent", maximumFractionDigits: 0, signDisplay: "exceptZero" });
const formatGrowth = (n: number) => signedPercent.format(n).replace("-", "\u2212"); // a true minus sign
// Year-over-year change in active users, as a ratio
const growth: WorldMapDatum[] = [
{ id: "US", value: 0.08 },
{ id: "BR", value: 0.34 },
{ id: "AR", value: -0.12 },
{ id: "DE", value: -0.07 },
{ id: "NG", value: 0.61 },
{ id: "IN", value: 0.58 },
{ id: "VN", value: 0.52 },
{ id: "RU", value: -0.31 },
];
export function Example() {
return (
<WorldMap
data={growth}
scale="diverging"
midpoint={0}
divergingColors={[2, 7]}
valueLabel="Change"
format={formatGrowth}
aria-label="Year-over-year change in active users by country"
/>
);
}Files to copy
14 folders · 27 files · 4 packages
- From
theme/src/ components/charts/{geo-map.tsx, chart-export-menu.tsx, chart-export.ts, chart-figure.tsx, chart-fit.tsx, chart-icons.tsx, chart-parts.tsx, chart-patterns.tsx, chart-tip.tsx, chart-utils.ts, heatmap.tsx}components/charts/geo/components/charts/chart-parts/components/charts/geo-map/components/charts/heatmap/components/drawer/parts/sheet.tsxcomponents/kbd/components/menu/components/skeleton/components/status-icons/hooks/{use-controllable.ts, use-intersection.ts, use-latest.ts, use-media-query.ts, use-preferences.ts}motion/tokens.tslib/{cn.ts, csv.ts, form.ts, glide-highlight.tsx, heading.ts, math.ts, popup-a11y.ts, popup-motion.ts, warn-once.ts}styles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/geo-map.jsonRegistry item: geo-map. The styles need the Tailwind v4 glass UI setup.- The examples also use
components/number-ticker/components/spinner/components/toast/hooks/use-direction.tslib/{canvas-effects.ts, state-light.tsx}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/number-ticker.json https://lokendra-builds.github.io/sheenui/r/toast.json- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Next.js: samples here pass functions (formatters, seriesLegend, a dashboard's load), so put them in a file that starts with "use client".
Bubble map
Bubbles at coordinates: their area follows the value, they keep their size on screen when you zoom, and a surface ring keeps neighbors apart. The size key reads in the same units.
Active users by city
Top 25 metro areas
import { WorldMap } from "@/components/sheenui/charts/geo-map";
// Package build (after the first npm release, or a packed tarball): import { WorldMap } from "@sheenui/theme";
const offices = [
{ label: "New York", lon: -74.0, lat: 40.71, value: 241_000 },
{ label: "San Francisco", lon: -122.42, lat: 37.77, value: 182_000 },
{ label: "London", lon: -0.13, lat: 51.51, value: 168_000 },
// …
];
<WorldMap
mode="bubble"
points={offices}
color={7}
valueLabel="Active users"
aria-label="Active users by city"
/>Classed scale, any locale
steps={5} snaps colors to five classes, easier to match against the key. locale="de-DE" formats the numbers and names every country in German (Intl.DisplayNames).
Internetnutzer je 100 Einwohner
Gerundet, illustrativ
import { WorldMap } from "@/components/sheenui/charts/geo-map";
import { type WorldMapDatum } from "@/components/sheenui/charts/geo-map/types";
// Package build (after the first npm release, or a packed tarball): import { WorldMap, type WorldMapDatum } from "@sheenui/theme";
// Internet users per 100 people
const internetUsers: WorldMapDatum[] = [
{ id: "DE", value: 92 },
{ id: "FR", value: 86 },
{ id: "NO", value: 99 },
{ id: "BR", value: 81 },
{ id: "IN", value: 46 },
{ id: "NG", value: 55 },
{ id: "ET", value: 19 },
];
export function Example() {
return (
<WorldMap
data={internetUsers}
steps={5}
color={3}
domain={[0, 100]}
locale="de-DE"
valueLabel="Je 100"
labels={{
instructions: "Pfeiltasten wechseln zum Nachbarland, Bild auf und Bild ab nach Wert …",
noData: "Keine Daten",
zoomIn: "Vergrößern",
zoomControls: (name) => `${name}: Zoom`,
// … every string is in WorldMapLabels
}}
aria-label="Internetnutzer je 100 Einwohner"
/>
);
}Props
WorldMapLabels keys and English defaults (20)
WorldMapTable props
Keyboard
Accessibility
- The map is one focusable figure with a role description of “map”; its accessible name ends with the keyboard instructions.
- Keyboard moves are announced once through a polite live region (“India: 912K, Rank 2 of 45”); pointer hovers stay silent.
- Missing values are hatched, never painted as the lowest color; the key includes a “No data” swatch.
- The Table view lists every value ranked, with an optional share column: the color-free way to read the map.
- Zoom buttons are real buttons (44px on touch), disabled at the limits; a plain scroll never hijacks the page.
- Forced colors: borders become CanvasText and the active country gets a Highlight outline.
All exports on this page
WorldMap— World map: a choropleth (each country coloured on a sequential or diverging scale) or a bubble map (circles sized by value at each country's centre, or at any longitude / latitude).WorldMapTable— Every value on the map as a ranked table: rank, country (or place), value and optional share.defaultWorldMapLabels— The built-in English strings of WorldMap; spread it into your own labels and change what you need.
When to use the world map
- Use it as a world map chart for a choropleth of year-over-year user growth by country, where equal changes get equally strong colors and the area of every country stays true to scale.
- It fits a bubble map of active users by city, placing bubbles at longitude and latitude, with area following the value and a size key under the map. It is a React map without a map library: the bundled outlines are drawn by the chart itself, so Leaflet or Mapbox are not needed.
- It also suits localized dashboards: pass locale, such as de-DE, and it formats the numbers and names every country with Intl.DisplayNames in that language.
- Skip it when you need sub-country detail such as states, streets or routes; the bundled outlines are countries only, so reach for a dedicated mapping tool.
- Pair it with ChartCard for the legend and Chart / Table tabs, WorldMapTable for a text table, and onSelect to show a country's detail in a Drawer or Popover.
Frequently asked questions
Related pages
48 charts pages in all: browse them on Charts.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .