Skip to content

pastetaste

Transit Widget

DataCardsAnimation

Departure and arrival card: two codes, a route line with a marker that travels as the ETA counts down, scheduled times, on-time and delayed states. Wide tile in dark, light or accent.

Paste it into Claude Code: it installs the component, asks for your brand and content, and places it on the page you name.

Install

Or by hand, in a Next.js project with shadcn set up. It writes components/pastetaste/transit-widget.tsx.

npx shadcn@latest add https://pastetaste.com/r/transit-widget.json
Dependencieswidget-frame

Prompt

Install the pastetaste component "Transit Widget" (transit-widget) into this Next.js project and use it.

What it is: Departure and arrival card: two codes, a route line with a marker that travels as the ETA counts down, scheduled times, on-time and delayed states. Wide tile in dark, light or accent.

Before you place it, ask me (one short message, in my language; "skip" = sensible default): which page and section it goes in, my brand colour (hex), the text, labels or images it should show, and whether I want my logo or my own copy in the demo content. Then:

Steps:
1. If the project has no components.json, run: npx shadcn@latest init -y -d. Then run: npx shadcn@latest add https://pastetaste.com/r/transit-widget.json
   (it writes components/pastetaste/transit-widget.tsx and its pastetaste dependencies: widget-frame; install any npm packages it reports).
2. Import it: import { TransitWidget } from "@/components/pastetaste/transit-widget" (check the file for the exact named export).
3. Put it where it fits on the page I name, keep the rest of the page untouched, and pass props for my colours instead of editing the installed file.
4. It does not depend on Tailwind; colours come from CSS variables (--pt-*) or props.
5. It supports prefers-reduced-motion with a still state; do not remove it.

Props (all optional unless the type has no default):
- from / to: { code: string; city?: string; time: string } = SJJ 14:30 / MUC 15:55 — The two stops: short code, optional place name for screen readers, scheduled time as shown.
- eta: number = 53 — Minutes left until arrival when the widget mounts. Changing it resets the countdown.
- duration: number = 85 — Length of the whole trip in minutes; the marker sits at 1 - eta / duration.
- minuteMs: number = 60000 — Real milliseconds per trip minute. 60000 is real time; smaller values run a time-lapse (ignored with reduced motion).
- delay: number = 0 — Delay in minutes; above 0 the status reads 'Delayed +n min' in the danger colour.
- loop: boolean = false — Restart the countdown about five seconds after arriving.
- onArrive: () => void — Called when the countdown reaches zero.
- tone / accent: WidgetTone / string = 'dark' / token — Tile surface and the one accent colour.

Live preview: https://pastetaste.com/c/transit-widget
Then run the dev server, check it in the browser at desktop and mobile width, and tell me the page URL.

Props 8

PropTypeDefaultDescription
from / to{ code: string; city?: string; time: string }SJJ 14:30 / MUC 15:55The two stops: short code, optional place name for screen readers, scheduled time as shown.
etanumber53Minutes left until arrival when the widget mounts. Changing it resets the countdown.
durationnumber85Length of the whole trip in minutes; the marker sits at 1 - eta / duration.
minuteMsnumber60000Real milliseconds per trip minute. 60000 is real time; smaller values run a time-lapse (ignored with reduced motion).
delaynumber0Delay in minutes; above 0 the status reads 'Delayed +n min' in the danger colour.
loopbooleanfalseRestart the countdown about five seconds after arriving.
onArrive() => void-Called when the countdown reaches zero.
tone / accentWidgetTone / string'dark' / tokenTile surface and the one accent colour.
View all →