shadcn.io is an independent project built on shadcn/ui
On this page5 sections
Installation
Overview
See who each site really serves, with this Voronoi catchments map for React with Ark UI. Panierly, a grocery delivery service, has seven hubs in real Paris neighbourhoods on a live Map that follows your theme, and the city is cut into one cell per hub: the ground nearer that hub than any other, computed in the file and clipped to the city's boundary. About a thousand dots, each some 2,000 residents scattered round the arrondissements by their approximate populations, are counted into the cells, and each cell is shaded in the chart ramp by its share of residents, with the legend under the map. Close a hub from the list and its neighbours take its ground; press Add a hub and click inside Paris to open up to three more, and every cell, share and bar redraws at once. Choosing a hub, from its row, its letter on the map or its cell, outlines the cell and fills the card with its residents, share, area and the distance to the nearest hub; Reset brings back the seven. Built from Map, Button and Guides. For delivery, retail and franchise planning, and any network that splits a city by distance.
FAQ
How are the cells drawn?
Each open hub starts with the whole city's boundary, then clipTo cuts it along the halfway line to every other open hub, keeping the side nearer its own. What remains is its Voronoi cell. East-west distances are shortened to Paris's latitude first, so the halfway lines are true on the ground. The cells are worked out again on every change, which takes a moment for ten hubs.
Where do the residents and their shares come from?
From a seeded sample in the file: for each arrondissement, one dot for every 2,000 of its approximate residents, scattered round its homes and kept inside the city. A dot belongs to its nearest open hub, which is the same as falling in that hub's cell, and a hub's share is its dots over all of them. The figures are rounded and the sample is invented; in your app, count real addresses or census blocks instead.
How do I add or close a hub?
Each hub in the list has a button beside it: close a hub and its cell goes to its neighbours, press it again to reopen. Add a hub turns the pointer into a crosshair; click inside the city's line to open a new hub there, up to three, and remove it from the list. The last open hub can't be closed. Nothing is saved, and a polite message gives the new count and the hub that serves the most.
Does a cell show who can be reached fastest?
No: it goes by straight-line distance, which ignores the river, the rails and one-way streets. That is a fair first cut for planning, and the same picture with travel times needs a routing service's matrix of times to every resident point.





