Skip to content

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

Cruise Routes Map Block for React

An eight-day voyage round the Hawaiian Islands on a live map: a Day slider moves the ship, the sea sailed is solid, and a rail lists every port call.

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

Show a voyage day by day, with this cruise routes map for React with Base UI. Marrowtide, a small-ship cruise line, sails eight days round the Hawaiian Islands, from Honolulu to Kahului, Hilo, Kailua-Kona and Nāwiliwili and back, on a live Map that follows your theme: five real ports, joined by the ship's route through the open channels between the islands, round Ka Lae at the foot of the Big Island and along the Nā Pali coast. A Slider from day 1 to day 8 moves the ship, a ring in the primary colour, to where it is that morning; the sea already sailed is drawn solid in the primary colour and the rest of the route dashed. The itinerary rail at the start lists the eight days with the port, the island and the times in port, and choosing a day there, or a port on the map, moves the ship as well. The readout under the slider gives the day's port and times, the nautical miles to the next port and the miles sailed so far, and the slider speaks the whole sentence ("Day 4, Hilo, 08:00 to 18:00, 149 nm to Kailua-Kona"). Built from Map, Slider and Guides. For cruise lines, tour operators and trip planners.

FAQ

How is the route drawn?

Each leg, from one port to the next, is a short list of points in LEG_LINES, typed by hand to leave each harbour by its mouth and cross the open channels between the islands, so the line never cuts across land. The map draws the whole route dashed, and the legs already behind the ship again, solid, on top. The map keeps one frame round the whole voyage, so moving the ship never moves the map.

Where do the nautical miles come from?

milesOf adds up each leg's segments as great-circle distances on a sphere of the Earth's radius and divides by 1.852 kilometres a nautical mile. The miles sailed on a morning are the legs that ended in a port by then, and the miles to the next port are the next leg's. The times in port are typed per day in DAY_LINES.

Where is the ship on a day in port overnight?

On the morning of each day the ship is in port: arriving that day, or still there from the night before, as on day 3 in Kahului and day 7 in Nāwiliwili. Days 1 and 8 are the start and the end in Honolulu. A port pressed on the map moves the ship to its first call after day 1.

What is real, and what stays local?

The ports, islands and seas are real; Marrowtide, the times and the exact route are invented sample data, and nothing is booked. The route and the times are typed into the file, so only the basemap is loaded: CARTO's free tiles over OpenStreetMap data, drawn by MapLibre GL under the Map component, with their credit in the corner.

Can I use it without a mouse?

Yes. The slider takes the arrow keys, Home and End and speaks the day, its port, its times and the miles to the next port; every day in the itinerary is a button, and the current one is marked as the current step. The ports on the map are a pointer shortcut, and the map takes the arrow keys and plus and minus once focused. A polite message says the day once the slider rests.

How does it look on a phone?

The map comes first with the whole voyage in view, then the slider and its readout, then the itinerary. Scrolling the page over the map scrolls the page, and two fingers pan it. The readout keeps two lines, so sliding through the days never changes the height of the page.