Skip to content

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

Parking Finder Map Block for React

Eight Edinburgh car parks round the Usher Hall on a live map, and a sortable table that prices each for a stay of 1 to 8 hours, with walks and free spaces.

On this page5 sections

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

Help drivers choose where to leave the car, with this parking finder map for React with Base UI. Bayhold, a parking app, puts eight car parks on real streets round Edinburgh's Usher Hall on a live Map that follows your theme, light or dark: each is a pin that reads "P" and its free spaces, or "Full" in a dashed outline when there are none, and two dashed rings mark 400 and 800 metres from the hall. A Native Select sets the stay (1, 2, 4 or 8 hours) and every car park is priced from its tariff: the first hour, then each further hour, up to a daily cap. The table under the map is the other half of the same data, with the name, the walk to the hall by the streets, the free spaces as a Progress meter and the price for the stay. Each column heading is a button that sorts the table, a second press flips the direction, and aria-sort says which column is sorted. Pressing a car park's row rings its pin, and pressing a pin marks its row. Built from Map, Native Select, Progress and Guides. For parking apps, venues, event sites and city guides.

FAQ

How is each price worked out?

priceOf takes the first hour's price, adds the hourly price for every further hour and stops at the daily cap, all in whole pence so nothing rounds. That is why the order by price changes with the stay: Lauriston Court is the second dearest for an hour but the second cheapest for eight, because its further hours are cheap and its cap is £10.

Where do the walks come from, and what stays local?

They were asked once, while the block was written, of OpenStreetMap's foot routing (OSRM) from each car park to the hall, and typed into LOT_LINES as seconds and metres. The rings are straight-line distances, so a car park inside the 800 metre ring can still be a 15 minute walk. Nothing is fetched at runtime but the map tiles, and nothing is reserved or sent; the hall and the streets are real, while Bayhold, the car parks, their spaces and their tariffs are sample data.

How does the sorting work?

Each column heading is a button inside its header cell. The first press sorts that column its natural way (walk, name and price from low to high, free spaces from most to fewest), a second press flips it, and aria-sort on the header cell says which way. Ties fall back to the name, so the order never jumps between equal rows.

Can I use it without a mouse?

Yes. The stay is a native select, the column headings are buttons, and each car park's name is a button with a pressed state that marks it on the map; the zoom buttons work from the keyboard, and the map takes the arrow keys and plus and minus once focused. A polite message reads the new order and the chosen car park once the controls settle.

How does it look on a phone?

The stay sits over the map, and the table keeps three columns: the car park with its free spaces under the name, the walk, and the price. The meter column comes back from the small breakpoint up. The page scrolls over the map; two fingers pan it.