shadcn.io is an independent project built on shadcn/ui
On this page5 sections
Installation
Overview
Find the park that has everything you asked for, with this park finder map for React with Base UI. Commonfield, a parks guide, outlines eight parks in and around Boston, from Boston Common to Franklin Park, on a live Map that follows your theme, each by its real OpenStreetMap boundary, with the area in acres worked out from that outline. A multiple Toggle Group of five activities, Playground, Dog run, Trails, Courts and Picnic, is an all-of filter: a park must have every activity that is on. Matching parks are filled and carry a pill with their acres; the others keep a dashed outline and a hollow dot, and the camera frames the matches after each change. Choosing a match, by its pill, its outline or its row, flies the map there and fills it in the primary colour. The list under the map keeps all eight parks in place, largest first, with a bar for size; each row names all five activities and strikes through the ones the park has none of, so a dimmed row shows exactly what it lacks. Built from Map, Toggle Group, Button and Guides. For parks departments, city guides, family apps and any place directory with amenities.
FAQ
How is the size of a park worked out?
Each park's outline is a typed list of corners in LINES, taken from its OpenStreetMap boundary and simplified to at most 36 corners. areaOf adds up the outline's edges on a sphere of the Earth's radius (the formula d3 and Turf use) and parkOf divides by 4,046.856 square metres an acre and rounds. The pill, the bar and the row all show that one number, close to but not the official acreage.
Why all of the activities and not any?
A family that wants a playground and a picnic spot wants both in one park, so every toggle narrows the result. The count on each toggle is how many parks have that activity on its own. Parks that miss one stay on the map with a dashed outline and in the list, dimmed, with the missing activity struck through in full colour, so you see why. When nothing matches, the status line says so: "No park has a playground, a dog run, trails and courts".
Where does the map look, and when does it move?
The block keeps one aim: the chosen park, else the parks that match, else all eight. MapCamera frames it on load and flies to each new one, quickly or not at all when reduced motion is on, with room above the parks for their pills. Pan and zoom freely in between; the trees button frames the matches again.
Where do the parks and the tiles come from, and what stays local?
The outlines are typed into the file, so the block fetches nothing but the basemap: CARTO's free tiles over OpenStreetMap data, loaded by MapLibre GL under the Map component, with their credit in the corner. The parks and their boundaries are real; Commonfield and every amenity are invented sample data, and nothing is booked or sent.
Can I use it without a mouse?
Yes. The activities are a toggle group (arrow keys and Space), and every matching park in the list is a button with a pressed state that flies the map to it; dimmed parks are turned off and skipped. The map itself takes the arrow keys and plus and minus once focused. A polite message gives the number of matches and the chosen park once the choice settles.
How does it look on a phone?
The toggles wrap above the map and the map keeps a fixed height; scrolling the page over it scrolls the page, and two fingers pan it. Each row wraps its activities onto two lines and keeps the acres and the neighbourhood at its end. Filtering never moves a row or changes the block's height.





