Skip to content

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

Flood Zones Map Block for React

Nested 1 in 10 to 1 in 500 year flood extents along the River Ouse in York on a live map, a period toggle, and six buildings checked inside or dry.

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

Show which buildings a river can reach, and how often, with this flood zones map for React with Base UI. Rivermark, a flood-risk map, draws four nested flood extents along the River Ouse through York, England, on a live Map that follows your theme: the 1 in 10, 1 in 50, 1 in 100 and 1 in 500 year events, wide over the ings north and south of the city and narrow between its walls. A Toggle Group in the toolbar picks the return period, the extents up to it are shaded on top of each other so the shade is densest beside the river, and each outline has its own dash, named in the legend under the map. Six buildings on the real banks, a clinic, two schools, a care home, a substation and a pumping station, are checked against the same polygons the map draws: a filled badge and the word "Inside" when the extent holds them, a hollow one and "Dry" when it doesn't. The Table under the map gives each building's neighbourhood, the first period that reaches it and its state now, and the toolbar counts them ("4 of 6 inside", with the chance a year). Built from Map, Toggle Group, Table and Guides. For flood-risk, insurance, planning and utilities tools.

FAQ

Where do the extents come from, and what stays local?

OUTLINES holds one polygon per period, at most 40 points each, drawn round the Ouse's real course while the block was written: wider over Clifton and Fulford Ings, narrower in the centre. They are illustrations, not a hydraulic model. ASSET_LINES holds the six buildings, invented names on real streets. Nothing is fetched but the map tiles; in your app load the extents your flood model or authority publishes, and never present a demo like this as a flood warning.

How is a building counted as inside?

A ray-casting point-in-polygon test runs on each building's coordinates against each period's polygon when the page loads, and the first period that holds it is stored. Because the test reads the same polygons the map draws, the table, the badges and the count never disagree. The extents nest, so a building inside the 1 in 50 is inside the 1 in 100 and 1 in 500 too.

What does 1 in 100 mean?

A flood that size has about a 1% chance of happening in any one year; it isn't a flood that comes once a century. The toolbar gives each period's chance a year next to the count: 10%, 2%, 1% and 0.2%.

Why aren't the periods different colours?

They stack instead: each extent is the same light shade, so the overlap is darkest where floods come most often, and each outline has its own dash (solid, dashed, dotted, long dashes) shown in the legend. The state of each building is a word in the table, so nothing depends on colour.

Can I use it without a mouse?

Yes. The return periods are a toggle group with the arrow keys, every building is a table row with its state in words, and the map takes the arrow keys and plus and minus once focused. A polite message reads the count and the names inside once the period changes.

How does it look on a phone?

The period toggle wraps above the map, the legend and caption sit under it, and the table drops its first-reached column to keep the name and the state. Changing the period never changes the length of the page.