Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Flight Tracker, animated React component

  • Pro
  • Cards
  • Spring

A live flight card: a plane banks along a dotted arc while the flown part fills in behind it, and the status line counts down to landing. Expand it for altitude, speed and distance left.

Props

PropTypeDefaultWhat it does
from"NYC"Departure airport code.
to"LON"Arrival airport code.
flight"MK 214"Flight number in the top-right corner.
departs"8:30 PM"Departure time under the origin code.
arrives"8:40 AM"Arrival time under the destination code.
minutes410Total flight time; drives the "Landing in N min" countdown.
miles3459Route length; drives the remaining distance in the details.
autoplayfalseFlies the plane along the arc on a loop (about 22 s per flight). Off by default: the plane stays at 35% of the route.

Add it to your project

  1. 1

    Set up your project once

    You need a Next.js project with Tailwind CSS and the @/ import alias. In its root folder, run this once. It creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 2

    Connect the registry with your API key

    Flight Tracker is a Pro item, so the CLI has to send your API key. Do this once per project:

    1. Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with nxs_ and is shown only once.
    2. In your project root, next to package.json, create a file named .env.local with this line, using your own key:
      NEXUS_API_KEY=nxs_your_key_here
    3. Open components.json and add this entry inside the outermost braces, next to "aliases". Leave {name} and ${NEXUS_API_KEY} exactly as written; the CLI fills them in:
      "registries": {
        "@nexus-labs": {
          "url": "https://www.nexus-ui.com/api/registry/{name}",
          "headers": {
            "Authorization": "Bearer ${NEXUS_API_KEY}"
          }
        }
      }

How Flight Tracker works

A live flight card. The plane flies along a dotted arc, banking to follow the curve, with the travelled part filling in behind it. The status line and

The source, the install command and the build prompt come with Pro.

Flight Tracker questions

How do I install Flight Tracker?

Run `npx shadcn@latest add @nexus-labs/flight-tracker`. It installs framer-motion. Flight Tracker is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).

Is Flight Tracker a ready-made flight status card for React?

Yes. It is a flight tracker UI card with origin and destination codes, a flight number, departure and arrival times, a countdown, remaining distance and a plane that flies along an arc. It is a visual component, not a data feed: you pass your own times, `minutes` and `miles` from any status API, but the plane position is held inside the component and does not follow them.

How do I set the route, times and flight number?

Pass `from`, `to`, `flight`, `departs` and `arrives` as strings (defaults NYC, LON, "MK 214", "8:30 PM", "8:40 AM"). The countdown comes from `minutes` (default 410) and the remaining distance from `miles` (default 3459).

Does it show real flight data?

No, it fetches nothing. Progress is a value inside the component that starts at 35% of the route, and there is no progress prop. With `autoplay` (off by default) the plane flies the arc on a loop, about 22 seconds per flight.

What do the status line and the Details panel show?

The status reads "On time", then "Landing in N min" past 85% of the route, then "Landed". Details expands altitude, speed and distance left. Distance uses `miles`; altitude and speed are worked out from the plane's position on the arc.

How is the plane drawn along the curve?

An SVG path is measured with `getPointAtLength` on every frame, and the plane is rotated to follow the curve, animated with Framer Motion. With prefers-reduced-motion on, the pulsing status dot stops pulsing; the plane itself is not changed.