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

react-address-select

v0.1.0

Published

A flexible React address autocomplete/select component with pluggable providers, locale/region biasing, and optional distance calculation.

Readme

react-address-select

npm version npm downloads

A flexible React address autocomplete/select library with pluggable providers, locale/region biasing, and optional distance calculation.

Features

  • Provider-agnostic API (AddressProvider)
  • Built-in Nominatim provider (OpenStreetMap)
  • Region biasing (bbox or center + radius)
  • Debounced search with caching + request cancelation (AbortController)
  • Optional distance calculation from an origin point
  • Minimal UI component included (AddressSelect)
  • Optional react-select/async wrapper (subpath export)

Install

npm i react-address-select

or

pnpm add react-address-select

Public API (stable)

Main entry (react-address-select)

UI

  • AddressSelect
  • Types: AddressSelectProps, AddressSelectOption

Core

  • useAddressSearch
  • createAddressSearcher
  • Types: UseAddressSearchOptions, UseAddressSearchResult, CreateAddressSearcherOptions, AddressSearcher, AddressOption

Providers

  • createNominatimProvider
  • Types: NominatimProviderOptions

Utils

  • distanceMeters
  • formatDistanceMeters

Types

  • AddressValue, AddressComponents
  • AddressProvider, AddressSearchContext
  • LatLon, RegionBias, BBox

Optional react-select entry (react-address-select/react-select)

  • AddressReactSelectAsync
  • Types: AddressReactSelectAsyncProps, AddressReactSelectAsyncOption

react-select is an optional peer dependency. If you don't use the wrapper, you don't need to install react-select.

Quick start (AddressSelect)

import { useMemo, useState } from "react";
import { AddressSelect, createNominatimProvider } from "react-address-select";
import type { AddressValue, RegionBias } from "react-address-select";

export function Example() {
  const provider = useMemo(() => createNominatimProvider(), []);
  const [value, setValue] = useState<AddressValue | null>(null);

  const origin = { lat: 48.1486, lon: 17.1077 };

  const regionBias: RegionBias = {
    type: "centerRadius",
    center: origin,
    radiusMeters: 40_000,
    strict: false,
  };

  return (
    <AddressSelect
      provider={provider}
      value={value}
      onChange={setValue}
      locale="en"
      origin={origin}
      regionBias={regionBias}
      placeholder="Type an address…"
    />
  );
}

react-select/async wrapper

Install react-select:

npm i react-select

(or pnpm add react-select)

Then:

import { useMemo, useState } from "react";
import { createNominatimProvider } from "react-address-select";
import { AddressReactSelectAsync } from "react-address-select/react-select";
import type { AddressValue } from "react-address-select";

export function ExampleReactSelect() {
  const provider = useMemo(() => createNominatimProvider(), []);
  const [value, setValue] = useState<AddressValue | null>(null);

  return (
    <AddressReactSelectAsync
      provider={provider}
      value={value}
      onChange={setValue}
      placeholder="Search address…"
    />
  );
}

Headless usage (useAddressSearch)

If you want to build your own UI, you can use the hook:

import { useMemo } from "react";
import { createNominatimProvider, useAddressSearch } from "react-address-select";

export function CustomUI() {
  const provider = useMemo(() => createNominatimProvider(), []);

  const { inputValue, setInputValue, options, isLoading } = useAddressSearch({
    provider,
    locale: "en",
    minChars: 3,
    debounceMs: 250,
    cacheTtlMs: 60_000,
    origin: { lat: 48.1486, lon: 17.1077 },
  });

  return (
    <div>
      <input value={inputValue} onChange={(e) => setInputValue(e.target.value)} />
      {isLoading ? <div>Loading…</div> : null}
      <ul>
        {options.map((o) => (
          <li key={o.id ?? o.label}>{o.label}</li>
        ))}
      </ul>
    </div>
  );
}

Locale notes (en / de / ua)

This package forwards locale to the provider.

For Nominatim, it is recommended to use IETF language tags (Accept-Language):

  • English: en
  • German: de
  • Ukrainian: uk

Provider notes (Nominatim / OpenStreetMap)

The built-in provider uses Nominatim (OpenStreetMap). Please respect the Nominatim usage policy. For production workloads, consider using your own instance or a provider with an SLA.

Browser note

Browsers restrict some headers (like User-Agent). If you pass userAgent to createNominatimProvider, it will only be usable in server-side environments that allow setting this header.

Demo

This repo contains a demo/ app (Vite) showcasing:

  • AddressSelect (minimal UI)
  • AddressReactSelectAsync (react-select wrapper)
  • Locale switching (en, de, uk)

Run it from the repo root:

pnpm install
pnpm -C demo dev

License

MIT