Skip to content

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

Restaurant Finder Map Block for React

Ten Melbourne restaurants on a live map with cuisine, price and rating filters whose options count what they leave, and a best-rated table under it.

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

Let diners narrow a city by what they feel like eating with this restaurant finder map for React with Base UI. Supperly, a dining guide, puts ten places across inner Melbourne, from Brunswick to South Melbourne, at their real neighbourhoods on a live Map that follows your theme, light or dark. Three facets sit in a bar above the map: a multi-select Toggle Group of cuisines (Italian, Thai, Lebanese, Vegetarian, Bakery), a price toggle ($ to $$$) and a minimum rating in a Native Select. Every option shows how many places it would leave with the other choices held, so "Thai 2" means two Thai places pass your price and rating. On the map each place is a pill with its cuisine's icon (the cuisine toggles are its key) and its price; a place that stops matching shrinks to a grey dot where it stands, so the map never jumps while you filter. Under the map a table ranks the matches best rated first, with their neighbourhood, price, rating and whether they are open at a fixed Friday evening; the places that don't match follow in grey, so the table keeps its ten rows and its height for every combination, and a Clear filters button brings everything back. Choosing a place, by its pill or its row, flies there and names it on the map. Built from Map, Toggle Group, Native Select, Button and Guides. For dining guides, city magazines and booking apps.

FAQ

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

From LINES at the top of the file: one line per place with its name, neighbourhood, longitude and latitude, cuisine, price level, rating in tenths and its opening and closing times in minutes after midnight. The neighbourhoods are real; Supperly, the places, ratings and hours are invented. Filtering happens in the browser on that array: nothing is searched or sent, and only the map tiles are loaded, from CARTO over OpenStreetMap data.

What do the numbers on the options mean?

Each is the number of places that would match if you chose that option and kept the other two facets as they are. cuisineCount asks for that cuisine alone with your price and rating, priceCount for that price with your cuisines and rating, and ratingOption for that minimum with your cuisines and price. They update on every change, so you can see a dead end before you press it.

Why doesn't the map move when I filter?

So you can compare: the ten places keep their spots and only their marks change, a pill for a match and a grey dot for the rest, which can't be chosen. The camera has one aim, the whole city (CITY, the corners of the ten places) or the chosen place: MapCamera frames it when the map starts and flies to each new one, at once when reduced motion is on. Choosing a place in the table or on the map flies there; choosing it again frames the city.

How are the opening hours worked out?

From AS_OF, a fixed Friday at 7:30 pm in the file, compared with each place's opening and closing minutes, so the demo reads the same at any hour. In your app pass the current time in the city's time zone, and add a weekday to each place if some close on certain days.

Can I use it without a mouse?

Yes. The cuisines and prices are toggle groups, the rating is a native select, every matching place in the table is a button that chooses it, and Clear filters resets all three; the zoom buttons work from the keyboard and the map takes the arrow keys and plus and minus once focused. The pills on the map are a pointer shortcut to the same choice. A polite message says how many places match once the facets settle.

How does it look on a phone?

The facets wrap into rows above the map, the map comes next, its pills down to the cuisine icon so close places don't crowd, then the table. On a phone the table keeps the place, its neighbourhood, price and rating and drops the hours column; from tablet width down the cuisine moves under the name, or "No match" for a greyed row. The page scrolls over the map; hold Ctrl or ⌘ to zoom it with the wheel, or use two fingers.