Skip to content

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

Flight Routes Map Block for React

Twelve routes of three airlines as arcs between twelve real European airports, with a checkbox per airline and route lists that fly the map along a route.

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 who flies where, with this flight routes map for React with Base UI. Flightmoor, an airline route planner, draws twelve routes of three invented airlines as curved arcs on a live Map of Europe that follows your theme: Ploverair flies solid arcs from Dublin, Heronline dashed ones from Copenhagen and Quillwing dotted ones from Lisbon, each to four of twelve real airports, with the three hubs as labelled squares. A Checkbox per airline in the toolbar shows or hides its arcs, and an airport that no shown route serves fades. Under the map, a column per airline lists its routes with the great-circle distance and a flying time at 800 km an hour plus 30 minutes. Choosing a route, in its column or by clicking its arc, draws it in the primary colour over the faded rest, names its two cities and flies the camera along it; the expand button frames the whole network again, and choosing a route of a hidden airline shows that airline again. Built from Map, Checkbox, Button, Label and Guides. For airline route planners, travel sites and network maps.

FAQ

How are the distance and the time worked out?

haversine measures the great circle between the two airports' latitude and longitude, in kilometres, rounded. The time is that distance at 800 km an hour plus 30 minutes for taxi and climb (CRUISE_KMH, TAXI_MINUTES). It's a straight great-circle figure, not a filed flight plan, and the caption says the airlines are invented.

How are the arcs drawn and told apart?

Each airline is one arc layer from its hub, bowed by a curvature of 0.22 so that two routes from the same hub never sit on one line. Airlines differ by line style, solid, dashed and dotted, and by name, never by colour alone. The chosen arc takes the primary colour and a heavier line while the others fade to a fifth; hovering an arc thickens it.

How does the map fly to a route?

The block keeps one aim: every airport, or the two ends of the chosen route. The camera frames that aim when the map starts and flies to each new one, quickly or not at all under reduced motion, and comes no closer than zoom 5.5 so a short hop keeps its surroundings. Pan and zoom freely in between; the expand button aims at the whole network again.

Can I use it without a mouse?

Yes. Each airline is a labelled checkbox and each route is a button with a pressed state; press it again to clear it. The zoom and expand buttons work from the keyboard, and the map takes the arrow keys and plus and minus once focused. The arcs are a pointer shortcut to the same choice, and a polite message speaks the route, its distance and its time.

How does it look on a phone?

The checkboxes wrap above the map, the dots shrink and only the hub codes and a chosen route's two cities stay labelled, so nothing crowds; the three airline columns stack under the map. Hiding an airline never changes the block's height: its routes stay listed, marked hidden on the map.

What stays local, and how do I use my own routes?

Everything: the airlines are invented, the airports are real places, nothing is booked or priced and no schedule is fetched. The tiles are CARTO's basemaps over OpenStreetMap data, drawn by MapLibre GL. Edit AIRPORT_LINES (code, city, longitude, latitude), AIRLINES and ROUTE_LINES (airline, from, to); the arcs, distances, times and counts are computed from them.