shadcn.io is an independent project built on shadcn/ui
On this page5 sections
Installation
Overview
Tell drivers which roads are shut and the way round, with this road closures map for React with Base UI. Roadwarden, a city traffic office, lists seven closures in Chicago's West Town and Wicker Park, on Milwaukee, Damen, Division, North Avenue and their neighbours, each a striped bar along the closed stretch of a live Map that follows your theme. The kind is a badge as well as a word: a barrier in a square for roadworks, a warning sign for a crash, a flag for an event. Choosing a closure in the list at the start, or its badge on the map, flies the camera there, draws its detour along the real streets with the delay on it, and fills the band under the map with the stretch, a note, the delay, the streets round and the time it reopens. A Toggle Group filters the list by kind while the list keeps its height, and the other badges fade. One closure has already reopened: it is faded, draws no detour and adds no delay. The foot of the list totals the minutes the open detours add. Built from Map, Toggle Group, Button and Guides. For city traffic offices, delivery fleets and navigation apps.
FAQ
Where do the streets and detours come from, and what is live?
Each closed stretch and each detour was traced once along the streets with OSRM's driving profile, cleaned by hand and stored in SPECS as longitude,latitude pairs, so the detours follow real roads and their one-way rules. Nothing is fetched at run time except the map tiles, and nothing is sent. The streets are real; the closures, notes, delays and times are invented sample data, not live traffic.
How do the times work?
Every end time is a typed local time compared with a fixed AS_OF (9:00 on the board), never the device's clock. A closure whose end is before it has reopened: the row says when, the bar fades and it adds no delay. The rows say "until today 10:15" or the weekday, and the band gives the time with a time element.
How does the kind filter work?
The toggle group shows all closures or one kind. The list keeps a hidden copy of all seven rows, so its height never changes, and badges of other kinds fade on the map. If the filter hides the chosen closure, the choice moves to the first closure of that kind and the camera follows; the foot totals only the open closures in view.
How does the map follow the choice?
The block keeps one aim: the chosen closure with its detour, or every closure. MapCamera frames it with room for the controls and flies there on each change, at once under reduced motion. The scan button frames every closure again; pan and zoom freely in between.
Can I use it without a mouse?
Yes. The kind filter is a toggle group, every closure is a button in the list with its kind, end and delay in its name, and the zoom and scan buttons work from the keyboard; the map itself takes the arrow keys and plus and minus once focused. The badges on the map are a pointer shortcut to the same choice. A polite message gives the open count, the total delay and the chosen detour once the choice settles.





