El Salvador

An interactive SVG map of El Salvador's 14 departments, exported as the ElSalvadorMap React component. It is built on the shared map component from the shadcnmaps registry and accepts all of its props except data, which is fixed to the El Salvador dataset.

El Salvador
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @shadcnmaps/el-salvador

Requires @shadcnmaps in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { ElSalvadorMap } from '@/components/shadcnmaps/maps/el-salvador'export default function Page() {  return <ElSalvadorMap />}
  • Showing El Salvador departments on a dashboard, sales map, or logistics view where a country-level map is needed
  • Letting users click or hover a department to pick a region for a form, filter, or detail panel
  • Plotting per-department data such as counts or statuses using the shared map's marker or tooltip features
  • Building a shadcn/ui-styled regional selector for Salvadoran addresses or data entry

Examples

Basic map

Renders the El Salvador map with default behavior from the shared Map component.

basic-map.tsx
import { ElSalvadorMap } from '@/components/shadcnmaps/maps/el-salvador'export default function BasicExample() {  return (    <div className='w-full max-w-2xl'>      <ElSalvadorMap />    </div>  )}

Tracking a selected region

Imports the RegionId type so the selected department ID is strongly typed. The selection callback is only shown as a placeholder because its prop name is defined in the shared Map component, not in this item's source.

tracking-a-selected-region.tsx
import { useState } from 'react'import { ElSalvadorMap, type RegionId } from '@/components/shadcnmaps/maps/el-salvador'export default function SelectionExample() {  const [selected, setSelected] = useState<RegionId | null>(null)  return (    <div className='space-y-2'>      <p>Selected: {selected ?? 'none'}</p>      <ElSalvadorMap />    </div>  )}

Typed lookup of region IDs

Uses RegionId to build a typed list of department codes, for example for a select input.

typed-lookup-of-region-ids.tsx
import type { RegionId } from '@/components/shadcnmaps/maps/el-salvador'const regionIds: RegionId[] = ['UN', 'LI', 'PA', 'CU', 'SO', 'SS', 'MO', 'SM', 'SV', 'US', 'CH', 'SA', 'AH', 'CA']export function RegionOptions() {  return (    <select>      {regionIds.map((id) => (        <option key={id} value={id}>{id}</option>      ))}    </select>  )}

API reference

PropTypeDefaultDescription
...props (ElSalvadorMapProps)Omit<MapProps, 'data'>—Spread onto the shared Map component. The data prop is omitted because it is always set to the El Salvador dataset. The full list of accepted props is defined in the map registry item, which this item depends on, and is not shown in this item's source.
RegionId (type export)(typeof elSalvadorMapData)['regions'][number]['id']—Union of the 14 department codes: UN, LI, PA, CU, SO, SS, MO, SM, SV, US, CH, SA, AH, CA. Not a prop, but exported from the same module for typing selections.

Accessibility

  • Each department is a region in the SVG with a human-readable name (for example La Unión or San Salvador) and a two-letter abbreviation in the dataset, so the names can be used for labels and screen-reader text.
  • Keyboard and ARIA behavior depends on the shared Map component; verify that focus and selection are operable with the keyboard in your build.
  • Do not rely on color alone to show selection or status. Pair fills with a text label, tooltip content, or a legend.
  • Provide a text alternative or a visible list of departments for users who cannot perceive the map, for example a table or select element using RegionId values.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "El Salvador" component (shadcnmaps/el-salvador) from its shadcn registry.1. Install it with: npx shadcn@latest add @shadcnmaps/el-salvador2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: ...props (ElSalvadorMapProps), RegionId (type export).Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { ElSalvadorMap } from '@/components/shadcnmaps/maps/el-salvador'export default function Page() {  return <ElSalvadorMap />}```

Files & dependencies

  • registry/shadcnmaps/maps/el-salvador.tsx→ components/shadcnmaps/maps/el-salvador.tsx
  • registry/shadcnmaps/map-data/el-salvador.ts→ components/shadcnmaps/map-data/el-salvador.ts
registryDependencieshttps://shadcnmaps.com/r/map.json

Looks similar, elsewhere