Skip to content

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

Farmers Markets Map Block for React

Ten London farmers markets on a live map under a strip of seven days: pick a day to fade the closed ones and fill a row of cards with hours and season.

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 shoppers which markets open on which day, with this farmers markets map for React with Base UI. Gleanmarket, a market directory, puts ten markets in real London neighbourhoods, from Notting Hill to Blackheath and Walthamstow, on a live Map that follows your theme. A strip of seven days built from a Toggle Group sits above the map, each day with the number of markets open in October. Choosing a day keeps that day's baskets on the map and fades the others, and fills a row of cards under it, earliest opening first, with the hours, the season in months ("All year", "May to Oct") and an "Also Sunday" style Badge on a market that opens on two days. A card and its basket choose each other: pressing a card flies the map to its basket, and pressing a basket scrolls its card into view. Monday has no market and shows an empty state; a market out of season keeps a quiet card on its day saying when it is back. Built from Map, Toggle Group, Badge, Empty and Guides. For market directories, councils and local food guides.

FAQ

How are the day counts worked out?

openOn keeps the markets whose days include the day (Monday is 0) and whose season holds AS_MONTH, October, then sorts them by opening time. The strip shows that count for every day, the cards list the same markets, and the faded baskets are the rest. Riverside Pickers opens on Thursdays from June to September, so it is not counted in October and shows an out-of-season card instead.

How do the cards and the baskets stay in step?

They share one piece of state, the chosen market. A card sets it and the map flies to its basket; a basket sets it and the card row scrolls sideways until that card is in the middle, without moving the page. A new day clears the choice, sends the map back to all ten markets and the row back to its start. A faded basket only shows its name, since its market is closed that day.

What stays local, and how do I use my own markets?

Everything is typed in LINES: a name, the neighbourhood in words, the longitude and latitude, the days, the hours and the season's first and last month. The neighbourhoods are real; the markets, hours and seasons are invented sample data, nothing is booked or sent, and only the map tiles load, from CARTO's basemaps over OpenStreetMap data.

Can I use it without a mouse?

Yes. The days are a toggle group that takes the arrow keys, each named with its day and count ("Saturday, 5 markets"), and every open market's card is a button with a pressed state. The zoom buttons and the map itself (arrows, plus and minus) work from the keyboard. A polite message says how many markets open and the chosen one once the choice settles.

How does it look on a phone?

The seven days stay in one row with the day and its count stacked, the map comes next, and the cards scroll sideways with snap points, the next card peeking in from the edge. The row keeps its height for every day, empty state included, so the page never jumps.