shadcn.io is an independent project built on shadcn/ui
On this page5 sections
Installation
Overview
Let riders choose where the car stops, with this ride pickup map for Vue with Ark UI. Curbcall, a ride-hailing app, fixes a pin at the middle of a live Map of Barcelona's Eixample, round Passeig de Gràcia, that follows your theme, light or dark. Move the map under the pin: it lifts while the map moves and, once the map rests, the pickup snaps to the nearest of seven kerbside spots, always mid-block and never on a corner, with a dashed line for the walk from the pin and the minutes of the nearest car in the pin's head. That car's drive to the spot is drawn along the real streets, the cars of the other rides fade, and every car points the way it faces. The rail prices Standard, Comfort and XL for the trip to Barcelona Sants from that spot, each with its seats and how far away its nearest car is; a Native Select and the spots' dots fly the pin to a spot, and Request, a Shine Button, is the one action. Built from Map, Native Select, Shine Button and Guides. For ride-hailing, taxis, deliveries and any app where a place on the kerb matters more than an address.
FAQ
How does the pin pick a spot?
When the map comes to rest (onViewportChangeEnd), the block takes the map's middle, where the pin points, and finds the nearest of the seven spots as the crow flies. Within 200 m that spot is the pickup and the walk to it is drawn and given in metres; further away the pin has no pickup, its head shows dots and Request is off until you move closer.
Where do the minutes and the fares come from?
OpenStreetMap routing (OSRM) was asked once, at authoring time, how long each of the nine cars takes to reach each spot and how far each spot is from Barcelona Sants; the answers are typed into the file with each nearest car's drive. Those are free-flow times, so the block multiplies them by a typed traffic factor of 1.8. A fare is a flag fall plus a price per kilometre and per minute, times each ride's multiplier, with a minimum, all in integer cents. Curbcall, the cars and the prices are invented.
What does Request do?
Nothing leaves the page: the button turns off and a line says the ride was requested in this demo, nothing was sent and no car is coming. Moving the map or choosing another ride starts again. In your app, send the spot's id and the ride to your dispatch service instead.
Can I use it without a mouse?
Yes. The Pickup select lists every spot and flies the pin to the one you choose; the rides are buttons with a pressed state, and Request follows them. The map itself takes the arrow keys and plus and minus once focused, so the pin can be moved by keyboard too. A polite message reads the pickup, the walk, the nearest car's minutes and the fare once the map settles.




