Simple, lightweight, and highly customizable SVG maps for modern JavaScript projects.
9
stars
207
commits
TypeScript
primary language
Aug 28, 2026
updated
Simple, lightweight, and highly customizable SVG maps for modern JavaScript projects.
📚 Full Documentation: svg-world-maps.vercel.app
💬 Community: Discussions • Issues
We are thrilled to announce the v1.0.1 stable release! This major milestone brings:
npm install svg-world-maps
# or
yarn add svg-world-maps
# or
pnpm add svg-world-maps
import { createMap } from "svg-world-maps";
const App = () => {
// Generate the SVG string
const worldMap = createMap("world", {
background: "#e6f3ff",
borders: "#2c3e50",
hoverColor: "rgba(59, 130, 246, 0.3)",
showTooltip: true, // Native hover tooltips
showLabels: true, // Static text labels (where supported)
size: "lg" // Responsive size preset
});
return (
<div dangerouslySetInnerHTML={{ __html: worldMap }} />
);
};
export default App;
import { createMap } from "svg-world-maps";
const mapSVG = createMap("world", {
background: "#f8fafc",
borders: "#94a3b8",
hoverColor: "#3b82f6",
showTooltip: true
});
const container = document.getElementById("map-container");
container.innerHTML = mapSVG;
// Easy click handling via data attributes
container.addEventListener("click", (e) => {
if (e.target.tagName === "path") {
const code = e.target.dataset.code; // e.g., "US-CA"
const name = e.target.dataset.name; // e.g., "California"
console.log(`Clicked: ${name} (${code})`);
}
});
To keep your production bundle size minimal, only the world map is included by default. Add any of the 211+ optional maps on-demand using our CLI:
# Add a specific map (e.g., usa, germany, japan, brazil)
npx add-map usa
# Automatically register it in your codebase (DX booster!)
npx register-map
👉 See the full list of 212+ available maps in the Documentation
The README is just the beginning. For comprehensive guides, API references, and advanced use cases, visit our official documentation:
| Resource | Link |
|---|---|
| 🚀 Getting Started | Installation & Basic Usage |
| ⚙️ API Reference | createMap, registerMapData & Options |
| 📏 Size & Scaling | Presets and custom scale factors |
| 🖱️ Interactivity | Tooltips, Labels, and Click Handling |
| 📊 Maps Info Report | Real-time status of all 212+ maps |
| 🔄 Migration Guide | Upgrading to v1.0.0 |
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. We welcome:
Please read our Code of Conduct before contributing.
This project's code is distributed under the MIT License. See LICENSE for more information.
Please note that the underlying SVG map data (paths, viewBox coordinates, and labels) for specific countries and regions included in this package is sourced from SimpleMaps.
This map data is used in accordance with the SimpleMaps SVG Map Library License. The map data itself is not covered by the MIT license of this project and remains subject to SimpleMaps' terms of use (free for commercial use, attribution appreciated, and no redistribution "as is" without added value).
If you use these maps in your own projects, we kindly ask that you acknowledge SimpleMaps.
If you find svg-world-maps helpful in your project, please consider:
Made with ❤️ for the open-source community by homayounmmdy
TypeScript
99.9%
Simple, lightweight, and highly customizable SVG maps for modern JavaScript projects.
9
stars
207
commits
TypeScript
primary language
Aug 28, 2026
updated
Simple, lightweight, and highly customizable SVG maps for modern JavaScript projects.
📚 Full Documentation: svg-world-maps.vercel.app
💬 Community: Discussions • Issues
We are thrilled to announce the v1.0.1 stable release! This major milestone brings:
npm install svg-world-maps
# or
yarn add svg-world-maps
# or
pnpm add svg-world-maps
import { createMap } from "svg-world-maps";
const App = () => {
// Generate the SVG string
const worldMap = createMap("world", {
background: "#e6f3ff",
borders: "#2c3e50",
hoverColor: "rgba(59, 130, 246, 0.3)",
showTooltip: true, // Native hover tooltips
showLabels: true, // Static text labels (where supported)
size: "lg" // Responsive size preset
});
return (
<div dangerouslySetInnerHTML={{ __html: worldMap }} />
);
};
export default App;
import { createMap } from "svg-world-maps";
const mapSVG = createMap("world", {
background: "#f8fafc",
borders: "#94a3b8",
hoverColor: "#3b82f6",
showTooltip: true
});
const container = document.getElementById("map-container");
container.innerHTML = mapSVG;
// Easy click handling via data attributes
container.addEventListener("click", (e) => {
if (e.target.tagName === "path") {
const code = e.target.dataset.code; // e.g., "US-CA"
const name = e.target.dataset.name; // e.g., "California"
console.log(`Clicked: ${name} (${code})`);
}
});
To keep your production bundle size minimal, only the world map is included by default. Add any of the 211+ optional maps on-demand using our CLI:
# Add a specific map (e.g., usa, germany, japan, brazil)
npx add-map usa
# Automatically register it in your codebase (DX booster!)
npx register-map
👉 See the full list of 212+ available maps in the Documentation
The README is just the beginning. For comprehensive guides, API references, and advanced use cases, visit our official documentation:
| Resource | Link |
|---|---|
| 🚀 Getting Started | Installation & Basic Usage |
| ⚙️ API Reference | createMap, registerMapData & Options |
| 📏 Size & Scaling | Presets and custom scale factors |
| 🖱️ Interactivity | Tooltips, Labels, and Click Handling |
| 📊 Maps Info Report | Real-time status of all 212+ maps |
| 🔄 Migration Guide | Upgrading to v1.0.0 |
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. We welcome:
Please read our Code of Conduct before contributing.
This project's code is distributed under the MIT License. See LICENSE for more information.
Please note that the underlying SVG map data (paths, viewBox coordinates, and labels) for specific countries and regions included in this package is sourced from SimpleMaps.
This map data is used in accordance with the SimpleMaps SVG Map Library License. The map data itself is not covered by the MIT license of this project and remains subject to SimpleMaps' terms of use (free for commercial use, attribution appreciated, and no redistribution "as is" without added value).
If you use these maps in your own projects, we kindly ask that you acknowledge SimpleMaps.
If you find svg-world-maps helpful in your project, please consider:
Made with ❤️ for the open-source community by homayounmmdy
TypeScript
99.9%