Dotted Map
An SVG dotted world map with optional markers, staggered rows, pulse rings, and a generic renderMarkerOverlay hook for custom pins.
Default
Markers with flag clip + label pill via renderMarkerOverlay. Import flags from @/components/dotted-map/flags.
Loading…
Installation
CLI
Also needs
npm i svg-dotted-mapUsage
page.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| width | number | 150 | Width of the SVG map coordinate space. |
| height | number | 75 | Height of the SVG map coordinate space. |
| mapSamples | number | 1200 | Landmass sample count. Land dots are painted to a cached bitmap (not one SVG node per sample). Raise only for denser maps. |
| markers | Marker[] | [] | Lat/lng markers projected onto the map. |
| dotColor | string | currentColor | Fill color for landmass dots. |
| markerColor | string | "#FF6900" | Fill/stroke color for markers and pulse rings. |
| dotRadius | number | 0.2 | Radius of map sample dots. |
| stagger | boolean | true | Offset alternating rows for a staggered look. |
| pulse | boolean | false | Animate all markers (respects prefers-reduced-motion; per-marker pulse=false opts out). |
| renderMarkerOverlay | (args) => ReactNode | - | Custom SVG overlay per marker (x, y, r, and projected marker). |
| className | string | - | Classes on the root SVG. |
| style | CSSProperties | - | Inline styles merged into the SVG. |
Marker
marker.ts
Set pulse on DottedMap to animate all markers, or set marker.pulse per pin. Extend Marker with generics when you need overlay data.