Coordinate Input

Coordinate Input is a copy-paste React component that stops pin lands on the wrong continent before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/coordinate-input
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsPin lands on the wrong continent

Was this component page useful?

How do I install Coordinate Input?

pnpm dlx shadcn@latest add @bollard/coordinate-input

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

How do I use Coordinate Input in React?

coordinate-input-usage.tsx
import { CoordinateInput } from "@/components/ui/coordinate-input"

<CoordinateInput label="Warehouse location" expectedArea={pune} defaultValue="73.8567, 18.5204" />

What input mistakes does Coordinate Input catch?

  • Latitude and longitude swapped
  • West or south signs flipped, compared with the expected area
  • 0, 0 left as a default
  • Map links pasted in, using the pin rather than the map centre
  • DMS and decimal formats, read back as one point

What props does Coordinate Input accept?

CoordinateInput props
PropTypeDefault
label

Visible label.

string"Coordinates"
value

Controlled text, as typed or pasted.

string—
defaultValue

Initial text when uncontrolled.

string""
onValueChange

Called with the text and the point, or null while it can't be read or is out of range.

(text: string, point: LatLon | null) => void—
expectedArea

Where points should usually be. Enables the swapped and flipped-sign checks.

LatLon & { radiusKm: number; name?: string }—
hint

Helper text shown while the field is empty.

string—
messages

Override any of the default messages.

Partial<typeof COORDINATE_MESSAGES>—

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

How is Coordinate Input accessible?

  • Visible <label>; aria-invalid and aria-describedby to an aria-live="polite" status
  • Fix buttons have visible text
  • Icons are aria-hidden; the point is read back in text

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

What are the limitations and server boundaries?

  • Sign and swap checks need an expectedArea to compare against
  • Assumes WGS 84 latitude/longitude; projected coordinates are not supported
  • The OpenStreetMap link opens an external site

What expensive mistakes does Coordinate Input stop?

Pin lands on the wrong continent

Also known as

latitude longitude · lat lng · coordinates · gps · google maps link · dms · location · geo

Field type

What dependencies does Coordinate Input require?

Coordinate Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameCoordinate Input
Registry identifier@bollard/coordinate-input
Install commandnpx shadcn@latest add @bollard/coordinate-input
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Coordinate Input

What form validation mistake does Coordinate Input catch?

Coordinate Input prevents pin lands on the wrong continent. Reads coordinates in any common format and catches swapped or sign-flipped values, so a pin doesn't land on the wrong continent. Catches: Latitude and longitude swapped, West or south signs flipped, compared with the expected area, 0, 0 left as a default, Map links pasted in, using the pin rather than the map centre, DMS and decimal formats, read back as one point. Limitation: validate coordinate-input schemas on backend.

How do I install coordinate-input with shadcn?

Run `npx shadcn@latest add @bollard/coordinate-input`. Sources added: registry/default/coordinate-input/coordinate-input.tsx, registry/default/coordinate-input/coordinates.ts. Package requirements: lucide-react.

What props customize Coordinate Input?

Coordinate Input accepts `label`, `value`, `defaultValue`, `onValueChange`, `expectedArea`. Configures latitude longitude, lat lng, coordinates behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of coordinate-input?

Sign and swap checks need an expectedArea to compare against. Assumes WGS 84 latitude/longitude; projected coordinates are not supported. The OpenStreetMap link opens an external site Server requirement: backend verification for coordinate-input.

How does Coordinate Input meet accessibility guidelines?

Visible <label>; aria-invalid and aria-describedby to an aria-live="polite" status. Fix buttons have visible text. Icons are aria-hidden; the point is read back in text. Minimizes errors: lat long swapped, coordinates wrong sign.

Which components pair with Coordinate Input?