Components/Charts/WorldMap

WorldMap

Charts

Base world-map primitive — country polygons + fitted d3-geo projection.

The shared base primitive for every World* component. Paints 177 country polygons, optional graticule and sphere, and exposes a fitted d3-geo projection + path via a render-prop so higher-level components layer data on top. Use it directly when you need a bespoke map overlay.

Import

import { WorldMap } from "nosible-ux"

Examples

Countries only

With graticule and sphere

Custom overlay via render-prop

Accessibility

Pass aria-label describing what the map represents — the wrapper renders with role="img" so screen readers announce it as a single image rather than a pile of SVG paths. For interactive overlays, add focusable markers with their own labels.

Props

Name TypeDefaultDescription
aria-label
string | undefinedAccessible label forwarded to the `role="img"` wrapper.
background
string | undefinedWrapper background. Default: `WORLD_MAP_COLORS.obsidian`.
children
((ctx: WorldMapRenderContext) => ReactNode) | undefinedOverlay render-prop. Receives projection + path + countries.
countryFill
string | undefinedCountry polygon fill. Default: `WORLD_MAP_COLORS.slateCore`.
countryStroke
string | undefinedCountry polygon stroke. Default: `WORLD_MAP_COLORS.slate3`.
height
number | undefinedViewport height in px. Default: `450`.
projection
WorldProjectionKind | undefinedProjection family. Default: `"equalEarth"`.
width
number | undefinedViewport width in px. Default: `800`.
withCountries
boolean | undefinedRender the 177 country polygons as the base layer. Default: `true`.
withGraticule
boolean | undefinedRender the 20° graticule grid. Default: `false`.
withSphere
boolean | undefinedRender the projection sphere outline. Default: `false`.