Skip to content

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

Food Truck Tracker Map Block for React

Five food trucks round six real Austin pitches on a live map: move the day from lunch to dinner to see each truck's drive, and pick one for its menu.

On this page5 sections

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

Show where the trucks are at each point of the day, with this food truck tracker map for React with Base UI. Grillwheel, a food-truck guide, follows five trucks round six real pitches in Austin (Rainey Street, South Congress, East 6th Street, the Drag, Zilker Park and Mueller Lake Park) on a live Map that follows your theme. A dock under the map, built from a Toggle Group, moves the day along: Lunch, Afternoon or Dinner. Every truck stands at its typed pitch for that part of the day as a lettered pill, side by side when two share a pitch, and a truck that moved since the last part of the day leaves its drive on the map along the real roads: dashed for the others, solid for the chosen truck, with a ring where it came from. The dock counts the pitches in use, the trucks that moved and the kilometres they drove. The list of trucks says each one's cuisine, pitch and drive, and choosing a truck, in the list or on the map, flies the map to its drive and fills its card: where it stands, where it came from and its four-dish menu in a Table with prices in dollars and cents. Built from Map, Toggle Group, Table, Button and Guides. For street-food guides, festival apps and mobile vendors.

FAQ

How does a truck know where to stand?

Each truck in TRUCK_LINES has three pitch ids, one for lunch, the afternoon and dinner, and stopOf turns a truck and a part of the day into a pitch. The pitches are typed once in PITCH_LINES at real places on Austin's streets; the trucks, the rota and the menus are invented sample data, and nothing reads the clock.

Are the drives real?

Yes. Each drive between two pitches was asked once of the OSRM demo server when the block was written, simplified and typed into LEG_LINES with its metres and seconds, so the lines follow real roads, one-way streets included, and nothing is fetched while the page runs. A truck that stayed put draws no line, and lunch, the first stop of the day, draws none.

What does the map do when I choose a truck?

It flies to frame that truck's drive, or to its pitch when it stayed, and the drive turns solid with a ring where it began. Moving the day along keeps your view until you choose again; the map button under the zoom buttons frames all six pitches again.

What stays local, and how do I wire it up?

All of it: no order is placed and nothing is sent. Only the map tiles load, from CARTO's basemaps over OpenStreetMap data. In your app load the day's rota and menus from your scheduling service, and keep legOf as the one place a drive is looked up.

Can I use it without a mouse?

Yes. The parts of the day are a toggle group that takes the arrow keys, every truck is a button in the list with a pressed state, and the menu is a table. The zoom buttons and the map itself (arrows, plus and minus) work from the keyboard; the truck pills are a pointer shortcut to the same choice. A polite message gives the pitches, the moves and the chosen truck's place once the choice settles.

How does it look on a phone?

The map comes first, then the three parts of the day across the full width with the three counts under them, the list of trucks and the chosen truck's card and menu. Every row keeps its height, so moving the day along never moves the page.