Skip to content

shadcn.io is an independent project built on shadcn/ui

Location Picker Map Block for Solid

A form field with a pin fixed over a live map: move the map and the nearest address and the coordinates fill in, or type a pair to move it. Then confirm.

On this page5 sections
UI library: Ark UI

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Let people pick an exact spot as easily as they type an address, with this location picker map for Solid with Ark UI. Stoopnote, a grocery delivery app, asks where in De Pijp, Amsterdam, the courier should stop, and the answer is a form with a live Map as its first field, following your theme, light or dark. The pin stays in the middle and the map moves under it: drag the map, click a spot to fly there, or focus the map and use the arrow keys. The pin lifts while the map moves and drops when it rests, and then the form fills itself: the nearest of twelve real street corners as the drop-off address, with how far it is from the pin, and the latitude and longitude to five places. It works the other way too: type a latitude and a longitude and press Enter, and the map flies there, or the field says why it can't (not a number, out of range, outside the delivery area). Three buttons snap the pin to the nearest corners, each with its distance, and Confirm drop-off (a Shine Button, the one primary) marks the point as chosen without sending anything. Built from Map, Field, Input, Button, Shine Button and Guides. For checkouts, ride pickups, field reports, event check-ins and any form that needs a point, not just an address.

FAQ

How does the pin pick the address?

When the map comes to rest, its centre becomes the pin. Each of the twelve typed corners is measured from it along the earth's curve, and the nearest names the drop-off: "at this corner" within 15 m, the distance in metres up to 150 m, and beyond that the courier is told to use the coordinates. The three Snap buttons are the same list, nearest first. In your app, ask your own geocoder for the address at the pin instead of the typed list.

What happens when I type coordinates?

The two fields take a latitude and a longitude (a comma works as the decimal mark too). Press Enter in either, or leave the field, and the pair is checked: a number, within range, and inside the area Stoopnote delivers to. A good pair flies the map there and the address follows; a bad one keeps the map still, marks the field as invalid and says what's wrong under it.

Can I use it without a mouse?

Yes. Focus the map and use the arrow keys to move it (plus and minus zoom), then tab on through the address, the two coordinate fields, the three Snap buttons and Confirm drop-off. A polite message says where the pin rests once the map stops, and another confirms the drop-off.

How does it work on a phone?

The map comes first, as wide as the form; drag it with two fingers (one finger scrolls the page), or tap a spot to fly the pin there. The coordinate fields bring up the number keyboard, and the Snap buttons stack one under another.

Is my location sent anywhere?

No. The block never asks for the device's position, and Confirm only marks the point in the page: nothing is sent or saved. Only the map's tiles are fetched. The corners are real street corners and squares; Stoopnote and its delivery area are invented.