Skip to content

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

Departure Board Map Block for Vue

A stop's next eight departures beside a live map of Helsinki, every vehicle on its way placed on its line; press one to follow it, or run the clock.

On this page5 sections
UI library: Ark UI

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

See where the next tram really is, with this departure board map for Vue with Ark UI. Tramlit, a city transit app, shows Lasipalatsi on Helsinki's Mannerheimintie, where five lines meet: three trams on solid lines with round badges and two buses on dashed lines with square ones, each drawn along real streets on a live Map that follows your theme, light or dark. At 08:42 the board beside the map lists the next eight departures, with the line, where it goes, the time it leaves and the minutes until then, and every vehicle on its way stands on its line where the timetable puts it: its minutes away at its line's speed, measured back along the street from the stop. Pressing a departure, on the board or its badge on the map, follows its vehicle: its line turns to the primary colour, the camera stays on it, and the card under the board says how far it is from the stop, or how far on it has gone. Run the clock and the next ten minutes pass, sped up about thirty times: the vehicles move, the board counts down and drops what has left, and the followed one stays in view; the same button pauses it. Built from Map, Button and Guides. For transit apps, station screens, shuttle and campus bus trackers.

FAQ

How is each vehicle placed?

From the timetable, not a live feed. Each line has a speed (trams 18 km/h, buses 21.6 km/h, stops included) and the times it leaves the stop. A vehicle due in six minutes is six minutes of that speed back along its line from the stop, and the map puts its badge at that fraction of the route. A vehicle further away than its line's start hasn't set off yet and isn't drawn; one that has passed the stop carries on towards its end and then leaves the map.

What does following a vehicle do?

Its line is drawn in the primary colour over the others, its badge is inverted with its minutes under it, and the camera centres on it a little closer in. While the clock runs the camera moves with it step by step. Press the departure again, or the button with the frame icon by the zoom buttons, to see every line again; a vehicle that reaches the end of its line is let go.

What does the clock do, and can I stop it?

The board starts at a fixed 08:42. Run the clock and it moves five seconds at every step, a step every 150 milliseconds when the page keeps up, until ten minutes have passed, then stops by itself; the same button pauses it, and Back to 08:42 starts over. With reduced motion on it stays off, and following a departure still shows where its vehicle is.

Where do the lines and times come from?

The streets were traced once with the public OSRM router, from each line's start through the stop to its end, simplified and typed into the file; nothing is fetched but the map's tiles. The stop and the streets are real; Tramlit, the lines, their letters and every time are invented. In your app, place vehicles from your feed's positions or from your timetable the same way.

Can I use it without a mouse?

Yes. Every departure on the board is a button that follows its vehicle, and the clock, Back to 08:42 and the map's buttons are in the tab order; the map takes the arrow keys and plus and minus once focused. A polite message says what is followed and how far away it is, and when the clock pauses or stops.

How does it look on a phone?

The map comes first, then the board with the clock, the eight departures and the following card. Following a vehicle on a phone stops one zoom level further out than on a wide screen, so the streets round it stay in view. Scrolling over the map scrolls the page; two fingers pan it.