Socket
Book a DemoInstallSign in
Socket

ethiopia-svg-map

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethiopia-svg-map

A customizable React component for interactive SVG maps of Ethiopian regions with TypeScript support

1.1.5
latest
Source
npmnpm
Version published
Weekly downloads
2
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Ethiopian SVG Map Component

A customizable React component for rendering an interactive SVG map of Ethiopian regions with hover, click, and zoom functionalities.

Demo

🌐 Live Demo Website

📦 Installation

npm install ethiopia-svg-map
# or
yarn add ethiopia-svg-map
# or
pnpm install ethiopia-svg-map

🚀 Usage

Basic Example

import { useState } from 'react';
import { EthiopiaSvgMap } from 'ethiopia-svg-map';

const App = () => {
  const [selectedRegion, setSelectedRegion] = useState(null);
//sample datas
  const regionData = {
    tigray: {
      value: 5,
      label: 'Tigray',
      universities: ['Mekelle University', 'Aksum University']
      color:"#347433"
    },
    amhara: {
      value: 7,
      label: 'Amhara',
      color: "FFC107"
      universities: ['University of Gondar', 'Bahir Dar University']
    }
  //Add data for the other regions
  };

  return (
    <EthiopiaSvgMap
      regionData={regionData}
      selectedRegion={selectedRegion}
      setSelectedRegion={setSelectedRegion}
      defaultFillColor="#67AE6E"
      activeFillColor="#90C67C"
      hoverFillColor="#90C67C"
      strokeColor="#328E6E"
      strokeWidth={0.7}
      activeStrokeWidth={1}
      hoverOpacity={0.9}
      className="flex items-center justify-center w-full h-auto bg-gray-100"
      showValues
      showRegionLabels
      tooltipContent={(regionId, data) => (
        <Tooltip regionId={regionId} data={data} />
      )}
      enableZoom
      zoomLevel={1}
      showLegend
    />
  );
};

// Sample Tooltip Component
const Tooltip = ({ regionId, data }) => (
);

🧩 Props

PropTypeDefaultDescription
selectedRegionstring | nullnullCurrently selected region ID
setSelectedRegionReact.Dispatch<React.SetStateAction<string | null>>Setter function for region selection
regionDataRecord<string, RegionData>{}Custom data for each region
defaultFillColorstring#67AE6EDefault region fill color
activeFillColorstring#90C67CFill color for active region
hoverFillColorstring#90C67CFill color on region hover
strokeColorstring#328E6ERegion border color
activeStrokeColorstring#FFFFFFBorder color for active region
strokeWidthnumber0.7Default border width
activeStrokeWidthnumber1Border width for active region
hoverOpacitynumber0.9Opacity when hovering (0–1)
classNamestringflex items-center justify-center w-full h-auto bg-gray-100Container class
svgClassNamestringw-full h-autoSVG element class name
onRegionHover(regionId: string | null) => voidCallback when a region is hovered
onRegionClick(regionId: string) => voidCallback when a region is clicked
tooltipContent(regionId: string, data?: any) => React.ReactNodeRenders custom tooltip content
widthstring | number'100%'Width of the map
heightstring | number'auto'Height of the map
viewBoxstring'0 0 441.853 328.295'SVG viewBox
enableZoombooleanfalseEnables zoom support
zoomLevelnumber1Initial zoom level
customStylesstring''Custom CSS for SVG
showRegionLabelsbooleanfalseWhether to show region labels
labelClassNamestringtext-xs font-mediumCSS class for labels
labelPositionstring'center'Label position ('center', 'top', etc.)
showValuesbooleanfalseWhether to show numeric values for regions
valueFormatter(val: any) => string(val) => val.toString()Function to format value
defaultLabelStyleReact.CSSProperties{}Inline style for region labels
defaultValueStyleReact.CSSProperties{}Inline style for region values
showLegendbooleantrueWhether to show legend

🎨 Styling

This component uses Tailwind CSS.

Make sure to include it in your project (if not already):

<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">

📄 License

MIT

Keywords

react

FAQs

Package last updated on 08 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.