shadcn.io is an independent project built on shadcn/ui
On this page5 sections
Installation
Overview
See where a city grew, with this population density map for React with Base UI. Hearthcount, a city planning office, draws Hamburg's seven boroughs at their real borders on a live Map that follows your theme, light or dark, and fills them with one dot for every 2,500 people. A Toggle Group in the toolbar picks the year, 2000, 2025 or 2050 projected, and the dots follow the typed head counts: a dot that is kept stays put, and the dots new since the year before are hollow, so the growth shows where it landed, round HafenCity, Wilhelmsburg or Oberbillwerder. Each dot is placed by a seeded generator round the borough's real neighbourhoods, inside its border and off the port, the Elbe and the Alster. The toolbar says the dot total and the people total, which are the same number times 2,500, and a Table under the map gives each borough's people, its density and its change on the year before with an arrow; a row, or a borough's pill on the map, flies the map there. Built from Map, Toggle Group, Table, Button and Guides. For planning offices, housing teams and urban research.
FAQ
How are the dots placed?
scatterOf gives each borough as many dots as its 2050 count, in the order they arrive. The first year's dots crowd round the borough's typed neighbourhoods and the later ones round its new quarters, each as the sum of three seeded draws on each axis, kept only inside the border and off the water and drawn again otherwise. The seed is fixed, so the same dots land in the same places on the server and in every browser, and a dot never moves when the year changes. Its place inside the borough is only a guide, not an address.
Why does the dot total always match the people total?
Every borough's head count is a multiple of 2,500, so its dots are exactly its people over 2,500, and the toolbar's two numbers are the same sum in two units. The map shows a dot when the year it arrives in is the chosen year or earlier, so no rounding can creep in between the map and the table.
How are the change and the density worked out?
The change is the borough's people against the year before on the toggle, in whole percent, with an arrow up, down or flat; in 2000, the first year, there is nothing to compare. The density divides the people by the area inside the drawn border, so it includes the borough's parks, farmland and water.
Where do the borders and counts come from, and what stays local?
The borders come from OpenStreetMap, simplified to under 40 points each with their shared edges kept, and are typed into RINGS; the head counts in LINES are rounded sample figures, and 2050 is an invented projection, not the city's. The basemap tiles come from CARTO over OpenStreetMap data. Nothing is fetched besides the tiles, and nothing you choose is sent or saved.
Can I use it without a mouse?
Yes. The years are a toggle group, and every borough is a button in the table with its pressed state; the zoom buttons and the button that shows all of Hamburg 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 gives the totals and the chosen borough once the choice settles.





