Pin Drop Check

Measures a dropped map pin against the typed address and PIN area, so a delivery doesn't go to the wrong door.

StopsDelivery sent to the wrong door

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/pin-drop-check.json

The files land in your project. They're yours to edit.

Usage

pin-drop-check-usage.tsx
import { PinDropCheck, type LatLng, type PinSurface } from "@/components/ui/pin-drop-check"

<PinDropCheck
  pin={pin}
  address={address}
  addressPoint={addressPoint}
  pincode="411045"
  pincodeCenter={{ lat: 18.5603, lng: 73.7853 }}
  pincodeRadius={1500}
  accuracy={30}
  classify={classify}
  value={choice}
  onValueChange={setChoice}
/>

What it catches

  • Pin far from the typed address
  • Pin outside the PIN or postcode area
  • Pin in water or on a highway (from your classify helper)
  • Gaps smaller than GPS accuracy are ignored

Props

PinDropCheck props
PropTypeDefault
pin* (required)

Where the user dropped the pin.

LatLng | null—
address* (required)

The typed address as text, for the readback.

string—
addressPoint

The typed address, geocoded.

LatLng | nullnull
pincode

The typed PIN / postcode.

string—
pincodeCenter

Centre of that PIN area.

LatLng | nullnull
pincodeRadius

How far the PIN area reaches, in metres. Default 3000.

number—
accuracy

GPS accuracy of the pin in metres.

number—
farAfter

Gap in metres that counts as far. Default 250.

number—
surface

Where the pin landed, if you already know.

PinSurface—
classify

Geo helper that says where a point landed. Called after the pin settles; errors are ignored.

(point: LatLng) => PinSurface | Promise<PinSurface>—
value

Controlled choice.

"pin" | "address" | null—
defaultValue

Initial choice when uncontrolled.

"pin" | "address" | nullnull
onValueChange

Called when the user picks pin or address.

(value: "pin" | "address") => void—
renderMap

Draw your own map (Leaflet, Google, Mapbox). Defaults to a small SVG sketch.

(context: PinMapContext) => React.ReactNode—
messages

Every visible string.

Partial<PinDropMessages>—

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Sketch is role=img with an aria-label describing the gap
  • Choice group is labelled and described by the status
  • Loading and result lines have text; icons are aria-hidden

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

  • Needs your geocoder for the address and PIN centre
  • Surface checks depend on your geo helper
  • A straight-line distance, not the route

What it stops

Delivery sent to the wrong door

Also known as

map pin · delivery location · drop pin · geolocation · address · swiggy · zomato · location picker

Field type

Dependencies

Pairs well with