shadcn.io is an independent project built on shadcn/ui
On this page5 sections
Installation
Overview
Show how long the water lasts, with this water system map for React with Base UI. Weirwood, a water utility, draws on three upland reservoirs, Kielder Water in Northumberland, Haweswater in the Lake District and the Elan Valley in Wales, each joined by trunk mains to the two towns it supplies, at their real places on a live Map that follows your theme. A Toggle Group floating over the map sets 0, 2, 4 or 6 dry weeks: every reservoir loses a typed share of its level a week, so the gauge in its marker falls, and each town's tag gives its weeks of supply left and the restriction its reservoir's level brings, plain for none, dashed for a hosepipe ban and filled for rationing. Three cells under the map give each reservoir's level, restriction, weeks left and towns in words; choosing one, there or on the map, colours its mains and flies the camera to it and its towns. Built from Map, Toggle Group, Button and Guides. For water utilities, drought planning and public notices.
FAQ
How are weeks of supply and restrictions worked out?
Each reservoir has a level today and a drop in percentage points per dry week. After some dry weeks its level is today's minus weeks times the drop, never below zero; the weeks of supply left are that level over the drop, rounded down; and the restriction is None at 50 percent or more, a hosepipe ban from 25 percent and rationing below. These are typed rules, not a hydrological model; the caption calls them sample data, not a drought forecast.
Why do two towns always share a restriction?
In this demo each town is supplied by one reservoir, so it takes that reservoir's weeks and restriction. A real network moves water between systems; to show that, give each town a share from several reservoirs and work out its weeks from the mix.
Where does the data come from, and what stays local?
The reservoirs and towns are real places typed in LINES; Weirwood, the levels, the weekly drops and the thresholds are invented, and the mains are drawn straight between them. Only the map tiles are loaded, CARTO's free basemaps over OpenStreetMap data with their credit kept, and nothing is measured or sent.
How does the map fly to a reservoir's towns?
The block keeps one aim: the whole region or the chosen reservoir with its two towns. MapCamera frames it at the start and flies to each new one, at once under reduced motion, with room kept for the toggle over the map's top and the zoom buttons. The map button frames all three again.
Can I use it without a mouse?
Yes. The dry weeks are a labelled toggle group that takes the arrow keys, and the three reservoir cells are buttons with a pressed state that give the level, restriction, weeks left and towns in words. The gauges on the map are a pointer shortcut to the same choice, and a polite message says how many towns are restricted once the choice settles.





