shadcn.io is an independent project built on shadcn/ui
On this page5 sections
Installation
Overview
Show what is in force and for how long, with this weather alerts map for React with Base UI. Skywarden, a weather service, draws six alerts as polygons over western Washington on a live Map that follows your theme: a high wind warning on the coast, a gale watch on the Strait of Juan de Fuca, a winter storm warning over the Cascade passes, a flood watch on the Skagit and Snohomish, and advisories for wind round Puget Sound and fog down I-5. Severity is told three ways, never by colour alone: the outline (dotted for an advisory, dashed for a watch, solid for a warning), the fill stepping up the theme's chart colours, and the marker's shape round the type's icon (a circle, a diamond, a square). Under the map a 48-hour strip gives each alert a row with a bar from its start to its end against a "now" line; the row is a button, and pressing it, or a marker, flies the map to the polygon and fills the card floating over the map with when it was issued, when it runs, the hours left and the advice. A Toggle Group over the map filters by type; hidden alerts keep their rows, so nothing moves. Built from Map, Toggle Group, Button and Guides. For weather services, councils, farms and travel apps.
FAQ
Where do the alerts come from, and what stays local?
From LINES and OUTLINES in the file: each alert's name, type, severity, issued, start and end times as ISO strings, a marker point, the area in words, the advice, and a polygon drawn on the real geography. AS_OF is the fixed "now" every hour count is measured from. Nothing is fetched but the map tiles; in your app take alerts from your national weather service's feed and always link to the official warning.
Why isn't severity just red, amber and yellow?
Warnings that rely on colour fail for some eyes and in some themes. Here the outline is dotted, dashed or solid, the marker is a circle, diamond or square, and the strip draws a light, hatched or solid bar; the fill steps up the chart colours too, and the word is in the card and each row's name.
How are the times shown?
They are read from ISO strings with Date.parse and printed in Pacific time from their UTC parts, so the server and the browser print the same text, with time elements that carry the exact moment. The strip runs from six hours before AS_OF to 42 hours after; a bar that starts or ends beyond it is cut at the edge, and the card gives the real times.
Can I use it without a mouse?
Yes. Each row of the strip is a button named with its alert, severity and times, the type filter is a toggle group, and the map takes the arrow keys and plus and minus once focused. The markers and polygons are a pointer shortcut to the same choice, and a polite message reads the chosen alert once the choice settles.
What does the type filter do?
It keeps the alerts of one type (wind, snow, rain or fog) bright on the map and in the strip, fades the others' polygons and markers, and leaves their rows in place but hidden, so the page never changes height. If the chosen alert is filtered out, the first one left is chosen.





