Skip to content

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

Category Clusters Map Block for Ark UI

Restaurants grouped into donut-chart clusters of their price bands, split by zoom. Press a donut to zoom in, or a band in the legend to filter.

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

See what is inside every cluster, with this category clusters map for React with Ark UI. Couvertly, a restaurant guide, puts about two hundred restaurants across twelve real Rome neighbourhoods on a live Map that follows your theme, and groups them into clusters drawn as small donut charts: the ring is split by price band, from € to €€€€ in a fixed order from the top in the steps of the chart ramp, with the count in the middle, so cheap-eats Pigneto and San Lorenzo read apart from Via Veneto and Parioli at a glance. The groups are worked out in the file for five zoom bands, so they split as you zoom in, down to single restaurants shown as pills with their band; pressing a donut flies the map in to its restaurants. The four cells under the map are the legend and the filter at once: each counts its band's restaurants in the current view, and pressing one takes that band out of every donut, or puts it back. Built from Map, Button and Guides. For restaurant and hotel guides, property search, retail analytics and any map where what is in a cluster matters as much as how many.

FAQ

How is each donut drawn?

As a small SVG ring of four arcs, one per price band in a fixed order from the top, each as long as its share of the group, with a hair's gap between them; the number in the middle is the group's size, and the donut grows with it. The bands are told by their order and the legend's symbols as well as the chart ramp's steps, and each donut's tooltip and label list the counts in words, such as "21 restaurants: 9 €, 8 €€, 4 €€€".

How are the restaurants grouped?

In the file, for five zoom bands: below zoom 11.2 (a phone's view of the whole city), up to 12, up to 13.1, up to 14.6, and above, where every restaurant stands alone. For each of the first four the restaurants are placed as they would sit on the map at that zoom, and each group takes every restaurant within a set number of pixels of its first. The result is kept for each band and filter, so zooming or filtering only redraws. Groups far outside the view aren't drawn at all.

How do the legend cells filter?

Each cell is a button with a pressed state: pressed, its band is in the donuts; press it to take the band out, and every group is worked out again without it. The count in each cell is how many restaurants of that band are in the current view, whether shown or not. The last band shown can't be hidden.

Where do the restaurants come from, and what stays local?

From a seeded generator in the file: each of the twelve neighbourhoods gets a number of restaurants scattered round its centre and a mix of price bands, so every visit draws the same city. Couvertly and the restaurants are invented. Nothing is fetched but the map tiles, and nothing is sent or saved.

Can I use it without a mouse?

The four band cells are buttons, and the zoom buttons, the Show all of Rome button and the map itself (arrows, plus and minus) work from the keyboard, so you can zoom until the groups split. Pressing a donut is a pointer shortcut to the same zoom. A polite message says what is shown after each filter, and which group a pressed donut zooms in to.

How does it look on a phone?

The map comes first, framed on all of Rome in a handful of large groups, and the four band cells sit in two rows under it. Scrolling over the map scrolls the page; use two fingers to move or zoom it, or hold Ctrl or ⌘ and scroll to zoom on a computer.