Honest Pin
A location pin that never pretends: a frosted blur as wide as the real accuracy, fading as the fix ages. Its label names less the less it knows.
Needs: Location fixes with an accuracy radius (the browser's Geolocation API, or your backend's). No model. The preview replays a recorded morning.
Customize
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| fix | { lat: number; lng: number; accuracy: number; at: number; source: "gps" | "wifi" | "cell" } | null | required | The latest fix as the phone reported it, accuracy in metres and at in ms (or smoothed with Smoother from the fix algorithms). Null before the first one hides the pin. |
| name | string | required | Who this is: used in the label, the initial, the actions and what screen readers hear. |
| project | (p: { lat: number; lng: number }) => [number, number] | required | Your map's projection, from lat/lng to px inside the component's box. Keep it stable between renders: a new function re-aims the pin. |
| places | { name: string; lat: number; lng: number; radius?: number; area?: string }[] | "[]" | Saved places. The label names one only when the fix can actually tell them apart; area names the neighbourhood around it. |
| region | string | – | What to call the whole area when even the neighbourhood is a guess, e.g. "Bengaluru". |
| now | number | – | The clock in ms. Defaults to the real one, ticking every ten seconds; pass it to replay a recorded day. |
| onAsk | () => void | – | Ask their phone for a fresh fix. Adds the action; the ask settles when a fix with a new time arrives, and says so if none does in 20 s. |
| onCall | () => void | – | Adds a Call action, made the primary one when the pin can't settle where they are. |
| accent | string | "#2f6fd6" | Colour of the fix. Age fades it toward the surface; it never changes hue. |
| className | string | "" | Extra class on the root. |
| style | CSSProperties | – | Inline style on the root. |