opensourceui
GitHubTwitter/X
  1. Home
  2. Components
  3. Travel
  4. Flight Arrival
Back to Travel

Components / Travel

Flight Arrival

Free Travel React component — FlightArrivalWidget. MIT licensed, copy-paste ready for Next.js and Tailwind CSS.

Countdown to landing with departure and arrival airports and a plane moving along a progress bar. Built for travel dashboards and trip widgets.

Preview

Arrival in

53min

14:30

LHR London

16:30

IST India

Setup

How to use

Free for personal and commercial use. No UI attribution required. Include the MIT copyright notice when copying component source into your project. Read the MIT license.

  1. 1

    Run in your terminal:

    $npm install clsx tailwind-merge lucide-react
  2. 2

    Copy lib/cn.ts below. Skip if you already have cn().

  3. 3

    Copy the code below and create components/travel/flight-arrival-widget.tsx in your project.

  4. 4

    Import and render:

    Example

    import { FlightArrivalWidget } from "@/components/travel/flight-arrival-widget";

    <FlightArrivalWidget arrivalMinutes={53} />

lib/cn.ts

1
2
3
4
5
6
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
 
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

components/travel/flight-arrival-widget.tsx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
"use client";
 
import { forwardRef, type ComponentPropsWithoutRef } from "react";
 
import { cn } from "@/lib/cn";
import { PlaneTakeoff } from "lucide-react";
 
// Flight arrival countdown card — departure and arrival airports with minutes remaining.
export type FlightArrivalWidgetProps = Readonly<
{
// Minutes until arrival — drives the countdown label.
arrivalMinutes?: number;
// Departure airport details shown on the left.
departure?: { time: string; code: string; city: string };
// Arrival airport details shown on the right.
arrival?: { time: string; code: string; city: string };
} & ComponentPropsWithoutRef<"div">
>;
 
export const FlightArrivalWidget = forwardRef<
HTMLDivElement,
FlightArrivalWidgetProps
>(
(
{
className,
arrivalMinutes = 53,
departure = { time: "14:30", code: "LHR", city: "London" },
arrival = { time: "16:30", code: "IST", city: "India" },
...props
},
ref,
) => (
<div
ref={ref}
data-slot="flight-arrival-widget"
className={cn(
"flex h-44 w-44 flex-col justify-between rounded-3xl bg-neutral-900 p-4 font-sans text-white shadow-lg",
className,
)}
{...props}
>
<div>
<p className="text-[11px] text-neutral-400">Arrival in</p>
<p className="text-2xl font-bold">{arrivalMinutes}min</p>
</div>
 
<div className="space-y-2">
<div className="flex justify-between text-[10px]">
<div>
<p className="font-semibold">{departure.time}</p>
<p className="text-neutral-400">
{departure.code} {departure.city}
</p>
</div>
<div className="text-right">
<p className="font-semibold">{arrival.time}</p>
<p className="text-neutral-400">
{arrival.code} {arrival.city}
</p>
</div>
</div>
 
<div className="relative flex items-center">
<div className="h-1 flex-1 rounded-full bg-orange-500" />
<div className="absolute left-1/2 flex h-6 w-6 -translate-x-1/2 items-center justify-center rounded-full bg-neutral-800">
<PlaneTakeoff size={12} className="text-orange-400" />
</div>
<div className="h-1 flex-1 rounded-full border border-dashed border-neutral-600 bg-transparent" />
</div>
</div>
</div>
),
);
 
FlightArrivalWidget.displayName = "FlightArrivalWidget";
PreviousNext

On this

page

Jump to a section on this page.

  • lib/cn.ts
  • components/travel/flight-arrival-widget.tsx

Sponsor spot · demo preview

Logo

Your brand name

Your tagline or category

A short pitch about your product or service goes here. This is a preview of how sponsor cards will look in this sidebar.

Your call to action

This slot is available. Sponsor Opensource UI and reach developers browsing components every day.