Skip to content

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

Site Selection Compare Map Block for React

Compare two of five Manchester café sites on a live map with 400 m rings and counted rivals, and a table that marks the better site on five measures.

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

Choose between two shop sites on the numbers, with this site selection compare map for React with Base UI. Siteward, a retail site tool, weighs five candidate café units in central Manchester, from the Northern Quarter to Oxford Road, each a numbered square at its real place on a live Map that follows your theme, light or dark. Two Native Selects in the toolbar above the map choose the sites to compare (choosing the site the other select holds swaps them, and pressing a square on the map makes it the second site); the map flies to frame the pair and draws a dashed 400 metre ring round each, with every rival café inside a ring filled in. A Table under the map sets five measures against each other: footfall a day, rent a month, parking nearby, rivals within 400 metres (counted from the rivals on the map) and demographic fit. The better site on each row gets a check and the word Higher, Lower or Fewer, and a line under the table says who leads on how many. A Minimum footfall Slider fades every site under it on the map and flags it in the table's header, so you see what the floor would cut before you drop a site. Built from Map, Native Select, Slider, Table and Guides. For retail, restaurant and clinic site tools.

FAQ

How does it decide which site is better?

Each measure in CRITERIA has a direction: more is better for footfall, parking and fit, less is better for rent and rivals. standing compares the two sites on a row and returns win, lose or same; the winner gets the check and its word, the other keeps an invisible placeholder so the table never changes size, and verdictOf counts the wins for the line under the table.

Where does the rivals count come from?

From the map. rivalsNear counts the rival cafés in RIVALS within 400 metres of a site (a flat-earth distance, close enough inside a city centre), and the same test fills the rivals inside either ring on the map. Move a rival in the data and both the map and the table follow.

Why is there no overall score?

Because the weights are a judgement the person makes: a café that lives on passing trade weights footfall, a delivery kitchen weights rent. Counting wins is honest; a single score would hide a weighting nobody chose. If you want one, add a weights control and compute the score in one helper.

Can I use it without a mouse?

Yes. Both selects are labelled, the slider takes the arrow keys and announces values such as 4,000 people a day, and the zoom buttons work from the keyboard; the map itself takes the arrow keys and plus and minus once focused. The squares on the map are a pointer shortcut to the second select. A polite message gives the verdict and how many sites are under the minimum once the controls settle.

Is the data real, and what stays local?

The neighbourhoods and their places are real; Siteward, the units, the rivals and every figure are invented sample data, and none of it is advice. Nothing is fetched but the map tiles (CARTO's basemaps over OpenStreetMap data, credited in the corner) and nothing is saved or sent. In your app load candidate sites and competitors from your own data and show where each figure comes from.

How does it look on a phone?

The two selects and the slider stack above the map, the map keeps its full width at a fixed height and frames the pair, and the table keeps the measure and both sites in three columns, with the check and its word under each value. Scrolling the page over the map scrolls the page; two fingers move the map.