Skip to content

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

Disaster Response Map Block for React

A storm dispatch window on a live map of Charleston: six incidents, a pool too small for all, number fields that send units and real road routes.

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

Decide who goes short when there aren't enough units, with this disaster response map for React with Base UI. Cordonfield, an emergency coordination desk, runs a "Storm response" window over a live Map of Charleston, South Carolina, that follows your theme. Six incidents sit at their real places, from a flooded Crosstown to a washed-out road on Johns Island, each an icon badge for its kind, filled when severe, outlined when moderate and dashed when minor. Together they need more medics, engines and crews than the post in North Charleston holds, so the rail lists what each still lacks in words ("Short by 1 medic and 1 crew") and the pool floating over the map says what is left. Choosing an incident, in the rail or on the map, flies the camera to its road route from the post, and three Number Input fields send units from the pool: a used-up type stops at its limit. Every incident with units on the way gets its route drawn along the real roads, the chosen one solid and the others dashed. A Toggle Group in the top bar filters by severity, and the one primary, a Shine Button "Send units", commits the plan locally. Built from Map, Number Input, Toggle Group, Shine Button, Button and Guides. For emergency coordination, utilities and campus operations tools.

FAQ

Where do the incidents and routes come from, and what stays local?

Everything is typed in the file. LINES holds each incident (its name, place, kind, severity, the medics, engines and crews it needs, and its minutes and kilometres by road), POOL the units at the post and ROUTES each road route, asked of the public OSRM router once while the block was written and baked in, simplified. The places and roads are real; Cordonfield, the incidents and the counts are invented. Nothing is fetched but the map tiles, and nothing is sent: in your app wire the button to your dispatch system, and never use a demo like this for a real incident.

How does the pool work?

Every unit you give an incident leaves the pool, so each field's top is what that incident already has plus what the pool still holds. A used-up type stops at its limit, and you move units between incidents by lowering one field first. The pool holds 4 medics, 4 engines and 6 crews against needs of 5, 5 and 8, so some incident always goes short.

What do the lines and badges on the map mean?

A badge is an incident: its icon is the kind (flood, power lines, roof, trees, cars, road), its fill the severity, and its small number the row in the rail. A line is the road route from the post, drawn only for incidents with at least one unit on the way: solid for the one you chose, dashed for the rest. The severity filter fades the others and frames those it keeps.

What does Send units do?

It marks the current plan as sent in the demo and says how many units go to how many incidents; with nothing changed it says there is nothing new to send. The plan opens with James Island's units not yet sent, so the button starts live.

Can I use it without a mouse?

Yes. The incidents are buttons with a pressed state, the number fields take typed numbers and the arrow keys, the severity filter is a toggle group, and the map takes the arrow keys and plus and minus once focused. The badges on the map are a pointer shortcut to the same choice as the rail, and the status line under the window says whether the plan is sent.

How does it look on a phone?

The severity filter drops under the top bar, the incidents become a row of chips, and the map, its caption and the chosen incident's three fields follow in that order. Scrolling the page over the map scrolls the page; two fingers move the map.