shadcn.io is an independent project built on shadcn/ui
On this page5 sections
Installation
Overview
Tell customers whether you deliver to them and what it costs, with this delivery zones map for React with Base UI. Crumbline, a bakery in London Fields, delivers by cargo bike, and a live Map that follows your theme shades how far a bike rides in 15, 30 and 45 minutes along the real streets of east London, each area darker toward the bakery and edged solid, dashed or dotted. A Native Select above the map, or a dot on it, picks one of seven neighbourhoods from Dalston to Greenwich: the ride there is drawn on the roads, the camera frames the band it lands in, and a card over the map gives the band, the minutes and the kilometres. The band Table under the map marks the row with its arrival window, fee and minimum order, and a Number Input for the basket turns that into words: what's missing to reach the minimum, the fee, or how much more rides free. A neighbourhood past the last band gets a faded ride and a plain no. Built from Map, Native Select, Number Input, Table and Guides. For bakeries, grocers, restaurants and any local delivery page.
FAQ
Where do the areas and the rides come from, and what stays local?
They were worked out once, ahead of time, from OpenStreetMap's bike routing: each area by timing rides from the bakery out along 36 bearings, each neighbourhood's ride as a real route, then simplified and typed into the file as strings. The block fetches nothing but the map's own tiles, and nothing is ordered or sent. Crumbline, its fees, minimums and arrival windows are invented sample data.
How is a neighbourhood's band decided?
By its ride time: bandOf takes the first band whose minutes the ride fits in, so Angel at 20 minutes is in the 30-minute band, and Greenwich at 49 minutes is past the last one. The drawn areas come from the same routing, and every neighbourhood sits inside the area of its band. To change your bands, edit BANDS (the minutes, window, fee, minimum and edge) and the table, the map and the sentences follow.
What does the basket line say?
It compares the basket with the band. Under the band's minimum, it says how much to add; at or over the free line (40 pounds) it says the delivery is free; in between, it gives the fee and how much more rides free. Past the last band it says there's no delivery there yet. The sentences wait for the field to settle before a screen reader hears them.
Why does the map zoom when I change the neighbourhood?
MapCamera aims at the area of the band the ride lands in (or the widest one, and the neighbourhood, when it's past it), so a short ride gets a close view and a long one the whole of east London. It flies there, or jumps when reduced motion is on, and leaves room at the top for the ride card. Your own pans stay until the next choice.
Can I use it without a mouse?
Yes. The neighbourhood is a native select, the basket a number field with its own step buttons, and the zoom buttons work from the keyboard; the map itself takes the arrow keys, plus and minus once focused. The dots on the map are a pointer shortcut to the same choice as the select. The table marks the current band for screen readers too.
How does it look on a phone?
The two fields stack above the map, the ride card stays at the map's top, and the table keeps its four columns with the ride in minutes. The two result lines keep two lines of room, so the block doesn't jump as the sentences change. Scrolling the page over the map scrolls the page; two fingers move the map.




