Skip to content

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

Wildlife Tracker Map Block for React

Three collared animals tracked across the Serengeti and the Maasai Mara on a live map, with a quarter toggle, animal cells and a week-by-week replay.

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 season of movement, with this wildlife tracker map for React with Base UI. Collarline, a conservation biology project, follows three collared animals, Kito the wildebeest, Neema the plains zebra and Baraka the elephant, through a sample year of 52 weekly fixes across the Serengeti and the Maasai Mara, on a live Map that follows your theme, with both reserves' real boundaries shaded. A Toggle Group picks a quarter of the year: its thirteen weeks are drawn as a solid line with a dot for each fix, over the rest of the year dashed, and the readout adds up the weekly legs ("244 km this quarter, about 19 a week"). The animals are a row of radio cells under the map, each with its own kilometres for the quarter, so the wildebeest's migration and the elephant's home range compare at a glance. A "Replay season" Button redraws the quarter a week at a time in the primary colour, thirteen steps that stop by themselves; the same button pauses it, and with reduced motion on it shows the whole quarter at once. Built from Map, Toggle Group, Button and Guides. For conservation projects, field research, ranger teams and any movement data over time.

FAQ

Where do the weekly fixes come from?

They are made once, when the file loads. Each animal has a typed centre for each quarter (the southern plains, the Western Corridor, the Mara and the way back for the wildebeest), a reach in degrees and a seed. weeksOf moves it from the last quarter's centre to the new one over four weeks and adds a wander round it from a small seeded generator, so the same week always lands on the same spot and nothing is random at run time.

How are the kilometres worked out?

A quarter's track is the fix before it and its thirteen weeks, so the move into the new range counts for the quarter it starts. kmOf adds the great-circle distance of each weekly leg on a sphere of the Earth's radius and rounds; the weekly figure is that over thirteen. Straight legs between weekly fixes undercount the real path, as collar data does.

What moves, and how do I stop it?

Only the replay, and only when you press Replay season: it adds one week every 450 milliseconds and stops after thirteen. The same button reads Pause while it runs and stops it where it is; pressing it again carries on. When the browser asks for reduced motion, the button shows the whole quarter at once instead. Changing the quarter or the animal ends a replay.

What is real, and what stays local?

The places are real: the reserves' boundaries come from OpenStreetMap, simplified and typed into the file, and the basemap is CARTO's free tiles over OpenStreetMap data with their credit in the corner. Collarline, the animals and their tracks are invented sample data, not a live feed, and nothing is sent anywhere.

Can I use it without a mouse?

Yes. The quarters are a toggle group (arrow keys and Space), the animals are native radio buttons in a fieldset (arrow keys move between them), and Replay season is a button. The map itself takes the arrow keys and plus and minus once focused. A polite message gives the animal, the quarter and its kilometres after each change.

How does it look on a phone?

The map comes first, with the quarters, the replay button and the readout under it, then the three animal cells side by side. Scrolling the page over the map scrolls the page, and two fingers pan it. The map keeps its frame on every change, so the tracks can be compared in place.