shadcn.io is an independent project built on shadcn/ui
On this page5 sections
Installation
Overview
Show how the oceans carry heat, with this ocean currents map for React with Base UI. Currentgate, an ocean atlas, traces ten surface currents at their real places on a live Map drawn as a globe that follows your theme: five basins, each with a warm current as a solid line (the Gulf Stream, the Kuroshio, the Brazil, Agulhas and East Australian currents) and a cold one as a dashed line (the Canary, California, Benguela, West Australian and Humboldt currents). Small dots drift along every line in the direction of the flow, faster where the current runs faster; it is the block's one loop, with a Toggle named Pause, and it starts paused when the visitor asks for reduced motion. A pill on each current gives its sea temperature, filled for warm and hollow for cold. A Toggle Group floating over the globe keeps all, warm or cold currents, and the five cards under it are the basins, each with its two currents' temperatures and speeds in kilometres a day: choosing one turns the globe to it and draws its currents in the primary colour. Built from Map, Toggle, Toggle Group and Guides. For ocean atlases, climate explainers and schools.
FAQ
What moves, and how do I stop it?
Only the dots on the currents: one step every 120 milliseconds, each current's dots moving a share of its course set by its speed over its length, so the Gulf Stream's dots race and the Canary Current's crawl. The step counter wraps, so the loop is seamless and bounded. The Pause toggle stops the timer, and when the browser asks for reduced motion the block starts paused. The dots have their own small component, so only they redraw on each step.
Why a globe, and how does it turn?
The currents span every ocean, and no flat map shows the North Pacific's two sides together. The map uses MapLibre's globe projection, and the block keeps one aim, the chosen basin's centre: MapCamera turns the globe there when you press a card, quickly or not at all when reduced motion is on, and sizes it to the box (closer on a wide screen). Drag to turn it yourself in between; the currents and pills on the far side hide behind it.
How does the warm and cold filter work?
All shows both kinds; Warm or Cold fades the other kind's lines to a trace and hides their dots and pills, on every basin at once. Warm and cold are told by the line (solid or dashed) and the pill (filled or hollow), never by colour; the primary colour only marks the chosen basin.
Are the speeds and temperatures real?
The currents and their courses are real, traced by hand along their usual paths, but the speeds and temperatures are typical values, rounded, typed into LINES as sample data: a current's speed and warmth change with the season, the depth and the place along it. Only the basemap is loaded, CARTO's free tiles over OpenStreetMap data, with their credit in the corner.
Can I use it without a mouse?
Yes. The filter is a toggle group and Pause a toggle, both reachable from the keyboard over the map, and every basin card is a button with a pressed state. The globe itself takes the arrow keys and plus and minus once focused. A polite message names the basin's currents, their temperatures and speeds after each change.




