Skip to content

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

Pollution Monitor Map Block for React

Six Port of Rotterdam stations on a live map, an hour slider with Play, heat plumes that drift with the wind, and the chosen station's day and advice.

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

Watch a day of dust move through a port, with this pollution monitor map for React with Base UI. Hazelwind, a port authority, reads six monitoring stations at real places in the Port of Rotterdam, from Maasvlakte to Pernis, on a live Map in an app window that follows your theme, light or dark. A Slider under the map runs from 00:00 to 23:00 and reads out as a time, and a Play button steps through the rest of the day. Each hour re-values every station from its own 24-hour series: its pill shows the reading, a dot for its band from Good to Very poor and an arrow turned to that hour's wind, and a heat plume drifts downwind of it, as strong as its reading, in the theme's chart colours. The pane lists the six at that hour, and the chosen station's card gives its whole day as a sparkline with the hour marked, its peak and the advice for the band it is in, for example "Wear masks on the quays and pause open-air grinding." Choosing a station there or on the map flies the camera to it. Built from Map, Slider, Button and Guides. For ports, industrial estates and site safety teams.

FAQ

Where do the 24-hour series come from?

BASE is the port's typical day of fine dust, with a morning and an evening peak. Each station scales it by its own share and adds a small stateless wobble, so every station has its own series, the same on the server and in the browser. The readings are invented for this demo; in your app replace series with the hourly readings from your sensors.

How is each plume drawn?

plumeOf sets eighteen puffs downwind of every station, further apart in a stronger wind and spreading as they go, each weighed by the station's reading and fading with distance, and the heatmap blends them. It shows where the dust is likely heading, not a measurement between stations; the readings and bands are in the pane and the pills.

Where does the advice come from?

Each of the five bands has one sentence in ADVICE, written for a port, and the card shows the one for the band the chosen station is in at that hour. The bands' limits are in the legend. These are sample sentences and limits for the demo, not health or regulatory guidance.

Can I use it without a mouse?

Yes. The slider takes the arrow keys, Home and End, and reads its value as a time, the Play button steps through the hours and pauses, every station in the pane is a button that flies the map to it, and the zoom and frame buttons work from the keyboard. A polite message gives the highest station and the chosen one's band and advice once the hour settles, never mid-replay. Play is off when reduced motion is on.

What stays local in the demo, and how do I wire it up?

All of it. The stations' places are real; their readings, the wind and the advice are typed into the file, and nothing is fetched apart from the map tiles, published or saved. In your app load the day's hourly readings and wind from your sensor network, and keep bandOf, the one place a band is decided.

How does it look on a phone?

The window bar sits over the map, the hour slider and Play button follow under it with the legend, and the station list and the chosen station's card stack at the end. Moving the hour never changes the height of the block.