Skip to main content

βš™οΈ API Reference Overview

Welcome to the API Reference for svg-world-maps.

This section provides comprehensive, type-safe documentation for all core functions, configuration options, and interactive features of the library. Whether you are rendering a simple world map or building a complex, data-driven regional dashboard, you will find everything you need here.

Where to Start?

If you are new to the library, we recommend starting with the createMap guide to understand the core rendering function, and then exploring Interactive Features to make your maps come alive.


πŸ“š Core Documentation​

Explore the specific areas of the API below:

Documentation PageDescription
πŸ—ΊοΈ createMap & registerMapDataThe core functions for generating SVG map strings and loading optional regional data into the library registry.
πŸ“ Size & ScalingComplete guide to controlling map dimensions using responsive preset strings ('xs' to '4xl') or precise custom numeric scale factors.
πŸ–±οΈ Interactive FeaturesLearn how to enable native hover tooltips, static text labels, and smooth CSS hover color transitions out of the box.
⚑ Click Handling & EventsDiscover how to capture user interactions, read built-in data-code and data-name attributes, and build dynamic dashboards.

πŸ›‘οΈ TypeScript Support​

svg-world-maps is built with TypeScript first. All public APIs, configuration objects, and map data structures are strictly typed to provide autocomplete, inline documentation, and compile-time safety in your editor.

You can import the underlying types directly into your project:

import type {
MapType, // Union type of all 212+ supported map string identifiers
MapOptions, // The configuration object shape for createMap
MapData, // The structure of the imported map data file
MapState, // Individual state/country object within MapData
MapSize // Union type for size presets ('xs'-'4xl') or custom numbers
} from 'svg-world-maps';

  • πŸ“¦ Available Maps Report: View the complete, auto-generated list of all 212+ supported regions and their label support status.
  • πŸ’» GitHub Repository: View the source code, report issues, or contribute to the project.

πŸ’‘ Need Help?
If you encounter unexpected behavior or have questions about a specific API, please check the GitHub Discussions or open an Issue.