BjLocationData
Open · v1.0.5 · Benin Republic

Location data for Benin Republic.

BjLocationData is an open JavaScript library providing departments, towns, districts, and neighborhoods for Benin Republic. Drop a ready-made hierarchical selector into any web page — no backend, no API keys, no dependencies.

Live demo interactive
Selected location

Quick start

Three ways to integrate.

Use the CDN bundle directly, install via npm, or import the ES module. All three expose the same BjLocationData API.

CDN (script tag)
<script src="https://unpkg.com/location_data_bj/…/bundle.js"></script>
<div id="holder"></div>
<script>
  BjLocationData.init({ holderQuerySelector: "#holder" });
</script>
npm / ES module
npm install location_data_bj

import { departmentList, townsList } from 'location_data_bj'

const departments = departmentList()   // → IDepartment[]
const towns       = townsList()         // → ITown[]
Full widget initialisation
BjLocationData.init({
  holderQuerySelector: '#holder',
  useHierarchy:        true,          // filter child lists when parent changes
  useDefaultSelect:    true,          // include a blank "– select –" option
  level: ['department', 'town', 'district', 'neighborhood'],

  onDepartmentChange:   (v) => console.log('department', v),
  onTownChange:         (v) => console.log('town', v),
  onDistrictChange:     (v) => console.log('district', v),
  onNeighborhoodChange: (v) => console.log('neighborhood', v),
  onChanges:            (v) => console.log('any change', v),
});

Data

Complete territorial coverage.

All administrative divisions of Benin Republic — from the 12 departments down to individual neighborhoods — shipped as static data in the bundle.

Departments
12
Towns (Communes)
77
Districts (Arrondissements)
546
Neighborhoods (Quartiers)
5000+
Hierarchical selection Each level automatically filters to only show children of the selected parent.
Built-in search Optional full-text search across all location levels with configurable placeholder and no-results text.
Zero dependencies Pure TypeScript compiled to a single self-contained bundle. No runtime dependencies.
Framework agnostic Works in plain HTML, React, Vue, Angular, or any environment that can load a script tag or npm package.
Typed data Full TypeScript interfaces (IDepartment, ITown, IDistrict, INeighborhood) exported for type-safe usage.
Composable API Use the low-level data functions (departmentList, townsList, etc.) independently to build your own UI.