Skip to content

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

Glacier Tracking Map Block for React

Three Alpine glaciers in tabs, each on a live map with today's tongue and the ice it held in each survey since 1980 nested down the valley, with the rate.

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

Follow a glacier's retreat, with this glacier tracking map for React with Base UI. Firnline, a glaciology institute, surveys the fronts of three Alpine glaciers, the Rhône Glacier, the Mer de Glace and the Morteratsch, one per Tabs panel, each on a live Map that follows your theme, light or dark. Each map outlines the glacier's tongue today, from its real outline, and draws the ice it still had in each survey year from 1980 to 2020 as nested extents down the real valley below the snout: every extent is built from the valley's flow line and that year's typed front position, so they nest by construction. Six year cells under the map pick the survey: its extent fills in the theme's chart colour and its front gets a tag, and the band above the cells gives the retreat since 1980, the average rate a decade and how far below today's snout the ice still reached. The year stays the same as you switch glaciers, so the three can be compared at once. Built from Map, Tabs and Guides. For research institutes, climate dashboards and mountain tourism boards.

FAQ

How are the nested extents drawn?

extentOf walks the valley's flow line from just inside today's ice to that year's front, widens it to each side by the tongue's half-width and closes it with a round end, so an older survey always reaches further. The flow lines follow the real meltwater streams below each snout, and today's tongue is the glacier's outline from OpenStreetMap, simplified to at most 40 points.

How are the retreat and the rate worked out?

Retreat is the typed front position for the chosen year, in metres since 1980, and the rate is that retreat divided by the years since 1980, times ten; 1980 itself has none. Below today is the distance from that year's front to today's snout along the valley. The front positions are invented for this demo, not survey data.

Why a tab for each glacier?

The three glaciers are hundreds of kilometres apart, so each gets its own map framed on its tongue. Only the open tab's map is mounted, and the chosen year carries across, so switching tabs compares the same survey on another glacier.

Can I use it without a mouse?

Yes. The glaciers are tabs that the arrow keys move between, the six years are buttons with a pressed state, and the zoom buttons work from the keyboard; the map itself takes the arrow keys and plus and minus once focused. A polite message gives the retreat and the rate once the choice settles.

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

All of it. The outlines, flow lines and front positions are typed into the file; nothing is fetched apart from the map tiles. In your app load each survey's front position, or its own outline, from your glaciology database, and keep retreatOf and rateOf, which read only those numbers.

How does it look on a phone?

The tabs sit above the map, the figures follow in one row of three, and the six year cells fold into two rows of three. Switching the glacier or the year never changes the height of the block.