shadcn.io is an independent project built on shadcn/ui
On this page5 sections
Installation
Overview
Let people find a place by name, with this place search map for Vue with Ark UI. Wayfinch, a city guide, floats a search box over a live Map of Kyoto that follows your theme, light or dark, and answers from a typed gazetteer of twenty-four places: temples, shrines, stations, districts, parks and walks, each at its real place. Typing lists the matches under the box, best first (a name that starts with your words, then a word inside a name, then any name that holds them, then a kind, a ward or another name the place answers to, so "golden" finds Kinkaku-ji), with the matched letters in bold. Matching ignores case, accents, hyphens and spaces: "toji" finds Tō-ji. While the list is open every match carries its number on the map, the other places fade, and once you stop typing the camera frames the matches, so you see where each answer is before you pick. Picking one, from the list, the map, a nearby place or a recent search, flies the camera there and fills the card with what it is, its ward, a line about it, its coordinates and its three nearest places; it also goes to the top of the recent searches, which a Clear button empties. When nothing matches, the list says so and suggests what to try. Built from Map, Input Group, Button and Guides. For city guides, travel apps, real estate and any map people search by name.
FAQ
How are the results ordered?
searchFor folds the query and every name to plain lower-case letters and digits (fold), so accents, hyphens, apostrophes and spaces don't matter. A name that starts with the query ranks first, then a name where a word starts with it, then a name that holds it anywhere; places found only by their kind, their ward or the other names in also come last. Ties go in alphabetical order, and the list keeps the best eight.
Where do the places come from, and what stays local?
The twenty-four places are typed into LINES at the top of the file: a name, a kind, a ward, the real coordinates, other names and one line about the place. Wayfinch is invented. Nothing you type is sent or saved anywhere; only the map's tiles are loaded. In your app, swap searchFor for your geocoder or your own search endpoint and keep the list, the numbers and the camera as they are.
Can I search without a mouse?
Yes. The search box is a combobox: typing opens the list with the best match highlighted, the up and down arrows move through the matches (the highlighted one is announced and lit on the map), Enter picks, and Escape closes the list (the map goes back to your last pick), then clears the box. The nearby places, the recent searches, Clear and the map's buttons are all in the tab order, and a polite message gives the number of matches as you type and the place you picked.
What does the map show while I type?
Every place Wayfinch knows is a dot. While the list is open, each match turns into a numbered marker with the same number as its row and the rest fade to a quarter (your last pick, which keeps its name, only to 60 percent), so the list and the map read together; the highlighted row's marker is filled and drawn on top. Pressing a dot or a number picks that place too. Once a place is picked it gets a filled marker with its kind's icon and its name beside it.
How does the map move to a pick?
The block keeps one aim and hands it to MapCamera, which flies there (straight away when reduced motion is on) and keeps it clear of the floating card: the picked place, the matches while you type (once the typing has paused for a moment, so the map doesn't chase every letter), or every place. A single place is shown at its kind's zoom (districts, parks and walks a little wider than a temple or a station, and every place a step wider on a phone). The globe button frames all twenty-four places again, and your own pans and zooms stay until the aim changes; picking the same place again, from a recent search say, flies back to it.





