Skip to content

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

Restaurant Chain Map Block for React

Eight Austin smokehouses on a live map with a dish toggle: each badge shows the portions left tonight, hollow when sold out, square for a drive-through.

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

Answer "where can I get it tonight" with this restaurant chain map for React with Base UI. Smokerow, a casual-dining barbecue chain, puts its eight Austin smokehouses in their real neighbourhoods, from Crestview to Montopolis, on a live Map that follows your theme, light or dark. A Toggle Group of four dishes (Brisket plate, Smoked wings, Burnt ends, Pecan pie) says how many outlets still have each one ("5 of 8"), and every outlet's badge on the map shows the portions it has left of the chosen dish: solid while it has some, hollow with a dashed edge at 0 once it has sold out. Shape carries the second fact: a square badge has a drive-through, a round one is walk-in only. On wide screens a card floats over the map's start with the dishes, the eight outlets and the chosen one's hours, stock, price and tonight's special, all worked out at a fixed Friday evening; on phones and tablets it docks under the map. Choosing an outlet, on the map or in the list, flies the camera there, and the map button frames the whole city again. Built from Map, Toggle Group, Button and Guides. For restaurant chains, bakeries and any retailer that sells out of things.

FAQ

Where do the outlets and the stock come from, and what stays local?

From LINES at the top of the file: one line per outlet with its neighbourhood, longitude and latitude, a drive-through flag, opening and closing times in minutes after midnight, the portions left of each dish in the order of DISHES, and tonight's special. The neighbourhoods are real places in Austin; Smokerow, its stock, hours and prices (in integer cents) are invented. Nothing is ordered or sent: choosing a dish or an outlet only changes what the block shows. Only the map tiles are loaded, from CARTO over OpenStreetMap data.

How is a sold-out outlet told apart without colour?

By fill, edge and number: an outlet that has the dish is a solid badge with the portions left in it, one that has sold out is hollow with a dashed edge and shows 0, and the list says "Sold out" in words. Shape is a separate channel: square for a drive-through, round for walk-in only, both on the map and in the list's small glyphs. Nothing relies on a hue.

Where do the hours and the counts come from?

haveCount counts the outlets with more than 0 portions of a dish, and those counts sit on the toggle. The hours compare each outlet's opening and closing times with AS_MINUTES, a fixed Friday at 6:40 pm also shown in the caption as AS_OF, never the device's clock, so the demo reads the same at any hour. In your app pass the current time in the outlet's time zone and read the stock from your point-of-sale system.

How does the map fly to an outlet?

The block keeps one aim: the whole city (CITY, the corners of the eight outlets) or the chosen outlet. MapCamera frames it when the map starts and flies to each new one, at once when reduced motion is on. On wide screens its padding keeps the outlets clear of the floating card, on the side the card is on in either reading direction. Pan and zoom freely in between; the map button frames all eight again.

Can I use it without a mouse?

Yes. The dishes are a toggle group, every outlet in the list is a button that chooses it, and the zoom buttons and the frame-all button work from the keyboard; the map itself takes the arrow keys and plus and minus once focused. The badges on the map are a pointer shortcut to the same choice as the list. A polite message gives the dish's count and the chosen outlet's stock once the choice settles.

How does it look on a phone?

The map comes first, with the caption under it, then the card: the four dishes in two rows, the eight outlets and the chosen outlet's details. The page scrolls over the map; hold Ctrl or ⌘ to zoom it with the wheel, or use two fingers on a phone.