npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ta-interaktiv/react-municipality-search

v3.0.1

Published

React component that allows searching for Swiss municipalities with either ZIP code or place names.

Readme

@ta-interaktiv/react-municipality-search

A React component for searching Swiss municipalities by name or postal code (ZIP). The component provides autocomplete functionality with smart ranking, supports multiple locales (DE/FR), and can remember previously selected municipalities.

Installation

bun add @ta-interaktiv/react-municipality-search

Usage

import { MunicipalitySearch } from '@ta-interaktiv/react-municipality-search';

function MyComponent() {
  const handleSelection = (municipality) => {
    console.log('Selected:', municipality.NORMGEMEINDE, municipality.PLZ4);
  };

  return (
    <MunicipalitySearch
      municipalityData="2021v3"
      locale="de"
      onSelectionHandler={handleSelection}
    />
  );
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | municipalityData | string | "2021v3" | Which year/version of municipality data to use (see available data) | | locale | "de" \| "fr" | "de" | Locale for UI strings | | onSelectionHandler | (municipality: Municipality) => void | required | Callback when user selects a municipality | | placeholder | string | (locale-based) | Placeholder text for the search input | | dedupe | boolean | false | Deduplicate municipalities by name (ignoring ZIP) | | resetOnSelect | boolean | false | Reset the search after selection | | iconOnRightSide | boolean | false | Position search icon on the right side | | maxResults | number | 10 | Maximum number of results to display | | customMunicipalities | Municipality[] | undefined | Use custom municipality data instead of fetching | | selectedMunicipality | Municipality | undefined | Pre-selected municipality (read-only mode) | | selectedMunicipalityId | number | undefined | GDENR of pre-selected municipality | | onCloseHandler | () => void | undefined | Handler for close button in pre-selected mode | | inputBackgroundColor | string | "var(--site-background)" | Background color of input field | | resultBackgroundColor | string | "var(--site-background)" | Background color of results dropdown | | propertyToSearch | keyof Municipality | "NORMGEMEINDE" | Which municipality property to search (must be string) |

Available Municipality Data

View all available municipality data files and versions at:
https://interaktiv-mf.tagesanzeiger.ch/municipality-data/index.html

Available data includes:

  • Year-specific datasets (e.g., 20230101_de, 20240101_fr)
  • Latest versions (latest_de, latest_fr)
  • Custom regional datasets (e.g., 24h_municipalities, zrz_municipalities)
  • Versions with/without ZIP codes (_nozip suffix)

Municipality Type

interface Municipality {
  GDENR: number;          // Municipality number (BFS-Nr)
  ORTNAME?: string;       // Place name
  PLZ4?: number;          // 4-digit postal code
  PLZ6?: number;          // 6-digit postal code
  GDENAMK?: string;       // Short municipality name
  KTKZ: string;           // Canton abbreviation
  NORMORTSNAME?: string;  // Normalized place name
  NORMGEMEINDE: string;   // Normalized municipality name
  URL?: string;           // Optional URL
}

Search Behavior

  • By ZIP code: Enter numbers (e.g., "8000" or "3000") to search postal codes
  • By name: Enter letters (e.g., "Zürich" or "Bern") to search municipality/place names
  • Results are ranked by relevance: exact matches first, then word matches, then partial matches
  • Minimum 2 characters required to trigger search