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

nepali-address-picker

v1.0.0

Published

A React component for selecting Nepali addresses with cascading dropdowns

Readme

Nepali Address Picker

A React component for selecting Nepali addresses with cascading dropdowns. This component allows users to select a province, then a district, and finally a local body (municipality, metropolitan, rural municipality, or sub-metropolitan).

🌟 Features

  • 🗺️ Cascading Dropdowns: Province → District → Local Body
  • 🇳🇵 Nepali Language Support: Option to display names in both English and Nepali
  • 🎯 Default & Controlled Values: Pre-populate or fully control selections with value prop
  • 🎨 Modern Built-in Styling: No external CSS needed, fully responsive
  • 📏 Customizable Layout & Size: Horizontal/vertical layout, customizable select width/height
  • 📱 Responsive Design: Works on desktop and mobile devices
  • 🌙 Dark Mode Support: Automatic dark mode detection
  • 📦 TypeScript Support: Full TypeScript definitions included
  • 🔧 Utility Functions: Helper functions for data access and filtering

📦 Installation

npm install nepali-address-picker

🚀 Quick Start

Basic Usage (No Default Value)

import { useState } from 'react';
import { NepaliAddressPicker } from 'nepali-address-picker';

function App() {
  const [selectedAddress, setSelectedAddress] = useState({
    province: '',
    district: '',
    localBody: ''
  });

  const handleAddressChange = (address: any) => {
    setSelectedAddress({
      province: address?.province?.Provinces || address?.province || '',
      district: address?.district?.Name || address?.district || '',
      localBody: address?.localBody?.Name || address?.localBody || ''
    });
  };

  return (
    <NepaliAddressPicker
      value={selectedAddress}
      onAddressChange={handleAddressChange}
    />
  );
}

With Default Value (Controlled)

const DEFAULT_ADDRESS = {
  province: 'Bagmati',
  district: 'Kathmandu',
  localBody: 'Kathmandu'
};

function App() {
  const [selectedAddress, setSelectedAddress] = useState(DEFAULT_ADDRESS);
  // ...
  return (
    <NepaliAddressPicker
      value={selectedAddress}
      onAddressChange={handleAddressChange}
    />
  );
}

🆕 Customization

Layout (Horizontal or Vertical)

<NepaliAddressPicker layout="horizontal" ... /> // horizontal
<NepaliAddressPicker layout="vertical" ... />   // vertical (default)

Select Size

<NepaliAddressPicker selectWidth="300px" selectHeight="48px" ... />

Placeholders

<NepaliAddressPicker
  placeholder={{
    province: 'Select Province',
    district: 'Select District',
    localBody: 'Select Local Body'
  }}
  ...
/>

Built-in Modern Styling

  • No need to import any CSS file manually.
  • The component is fully styled and responsive out of the box.
  • You can override select size via props or with CSS variables:
    .nepali-address-picker {
      --address-select-width: 250px;
      --address-select-height: 40px;
    }

🔧 API Reference

Props

| Prop | Type | Default | Description | |-----------------|----------------------------------------------------------------------|--------------|----------------------------------------------------------| | onAddressChange | (address: AddressData) => void | - | Callback function called when address selection changes | | value | AddressData \| { province?: string; district?: string; localBody?: string } | - | Controlled value for the picker | | defaultValues | { province?: string; district?: string; localBody?: string } | - | (Uncontrolled) Default values to pre-populate selections | | showNepali | boolean | false | Whether to show Nepali names alongside English names | | className | string | '' | Additional CSS class for styling | | placeholder | { province?: string; district?: string; localBody?: string } | Default placeholders | Custom placeholder text for each dropdown | | layout | 'vertical' \| 'horizontal' | 'vertical' | Layout of the dropdowns | | selectWidth | string | 100% | Width of the select elements (e.g., '300px', '100%') | | selectHeight | string | 44px | Height of the select elements (e.g., '48px', '2.5rem') |

Types

AddressData

interface AddressData {
  province: ProvinceInfo | null;
  district: DistrictInfo | null;
  localBody: MunicipalityInfo | MetropolitanInfo | RuralMunicipalityInfo | SubMetroInfo | null;
}

ValueAddress (for value prop)

// You can use either AddressData or this simple object:
{
  province?: string;
  district?: string;
  localBody?: string;
}

🎨 Styling

  • Modern, responsive styling is built-in.
  • Customize select size via selectWidth and selectHeight props or CSS variables.
  • No external CSS import required.

📊 Data Coverage

The component uses official Nepali administrative data including:

  • 7 Provinces: All Nepali provinces
  • 77 Districts: All districts across provinces
  • 293 Municipalities: Regular municipalities
  • 6 Metropolitan Cities: Major metropolitan areas
  • 460 Rural Municipalities: Rural administrative areas
  • 11 Sub-Metropolitan Cities: Sub-metropolitan areas

🌐 Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the ISC License.

👨‍💻 Author

Manish Kumar Rajak

🆘 Support

If you encounter any issues or have questions, please open an issue on the GitHub repository.

🔗 Related