Skip to content

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

Turn By Turn Map Block for Solid

A drive across Paris as eleven turn-by-turn steps beside a live map. Press a step to face its way, frame its stretch and see the road done and to go.

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

Walk a drive through one turn at a time, with this turn-by-turn map for Solid with Ark UI. Turnlane, a driver app, takes a six-minute drive across eastern Paris, from Gare de Lyon up Avenue Daumesnil, round Place de la Bastille and into the Marais, and lists it as eleven steps in a rail beside a live Map that follows your theme, light or dark. Each step is one manoeuvre: an arrow for its kind (bear right, turn left, go round), the street, the clock time you reach it and the distance to the next turn. Press a step, in the rail, on its dot on the map or with the previous and next buttons in the banner floating over the map, and the camera turns to face the way you'll drive there, tilts a little and frames that stretch, drawn in the primary colour. The road already behind you is solid and the rest is dashed, and the meter at the top of the rail counts the distance done and to go. The route button frames the whole drive again, north up. Built from Map, Button and Guides. For ride-hailing and delivery apps, driving directions, travel guides and any trip told turn by turn.

FAQ

Where do the steps come from?

From OSRM, an open-source router over OpenStreetMap, asked once while the block was written with steps=true: each step's manoeuvre (its type and direction), its street, its length and its drive time, plus the road itself, simplified to a metre. The two steps OSRM gives for Place de la Bastille are merged into one, and each instruction in LINES is written from those fields. Nothing is fetched while the block runs except the map's tiles; in your app, ask your routing service for steps and map its manoeuvre types to the arrows.

How does the camera follow a step?

The block keeps one aim and hands it to MapCamera: for a step, the corners of its stretch of road, turned to the heading after its manoeuvre so the road ahead points up, tilted 40 degrees and no closer than zoom 17 (16 on a phone, which sees less round it); for the overview, the whole drive, north up and flat. It flies to each new aim, or jumps there when reduced motion is on. The compass turns the map back to north without changing the step.

What do the lines on the map mean?

The whole road is one route whose progress is set to the chosen step's first point: the part before it is drawn solid in a softened foreground colour, the rest dashed and fainter. The chosen step's stretch, from its turn to the next one, is a second, bolder route over it in the primary colour, with a casing in the background colour so it reads on any street. In the overview the whole road is solid. The rail's meter and its two figures say the same in words.

How are the times worked out?

The trip leaves at 08:40 on a fixed sample day. A step's time is the departure plus the drive times of every step before it, so the drop-off comes at 08:46. Nothing reads the device's clock, so the times are the same for everyone.

Can I use it without a mouse?

Yes. Every step in the rail is a button, and the chosen one is marked as the current step; the banner's previous and next buttons, the route button, the zoom buttons and the compass are all in the tab order, and the map takes the arrow keys and plus and minus once focused. The dots on the map are a pointer shortcut to the same choice. A polite message reads the step, the distance to the next turn and how far is done and to go once the choice settles.

How does it look on a phone?

The map comes first, with the banner across its top, then the trip's summary, the meter and every step in one list under it. From the medium breakpoint the steps sit in a rail at the start, beside the map, and scroll inside it; the chosen step is scrolled into the rail's view, never the page's. Scrolling over the map scrolls the page: hold Ctrl or ⌘ to zoom, or use two fingers on a phone.