Skip to content

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

Choropleth Drilldown Map Block for Ark UI

A world map shaded by conversion that drills into the US states on a click, with a breadcrumb back, a hover readout and a table of the top places.

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

Go from the world to a state in one click, with this choropleth drilldown map for React with Ark UI. Ordermere, a storefront analytics tool, shades one online shop's quarter by place on a live Map that follows your theme, light or dark: each of 22 countries is filled by its conversion rate (orders over visits) in five steps of the theme's chart ramp, and the countries with no orders stay a quiet grey. Click the United States, on the map or in the table, and the map drills down: the camera flies to the lower 48, the rest of the world greys out, the 50 states and DC are shaded on five steps of their own and the legend and the table follow. The breadcrumb in the toolbar, or the globe button by the zoom, goes back to the world with the United States still marked. Clicking any other country, or a state, chooses it: its border is drawn in the foreground and its row is marked. Hovering a place reads its conversion, orders and visits in the toolbar. The table under the map ranks the level's top eight by orders. Built from Map, Button and Guides. For sales and marketing dashboards, analytics tools and any figure that has a level below it.

FAQ

Where do the borders and the figures come from?

The borders are Natural Earth's, the pinned country and state files the Map component's own demo uses: the countries load with the map, the states only once you drill into them. The figures are typed into the file, a line per country and a line per state, and the states add up to the United States' line. Ordermere and every number are invented. Nothing else is fetched or saved; in your app, read your own figures and keep the codes (ADM0_A3 for countries, postal for states).

Why can only the United States be drilled into?

Natural Earth's small-scale state file covers the United States only. To drill into other countries, load a larger-scale file of provinces (Natural Earth's 10 m one covers the world) or your own boundaries, add their figures, and treat every country with a line there as one that drills.

How are the colours chosen?

Each level has five steps of the theme's chart ramp: the countries from under 1.5 percent to 3 percent and over, the states from under 2.5 percent to 4 percent and over, so the differences between states still show. On a light theme higher is darker; on a dark theme the ramp turns round and higher is lighter. The legend, the swatch beside each row and the percentage in the table say the same thing in text.

Can I use it without a mouse?

Yes. Every row of the table is a button: the United States drills down, any other place is chosen and pressed. The breadcrumb's World button, the globe button and the zoom buttons are in the tab order, and the map takes the arrow keys and plus and minus once focused. A polite message reads the new level, or the chosen place's figures, once the change settles.

How does it look on a phone?

The toolbar stacks the breadcrumb over the readout, the legend moves from the map's corner to a row under it, and the table drops the visits column to keep the orders and the conversion. Tapping a place chooses it and reads its figures in the toolbar. Scrolling over the map scrolls the page: hold Ctrl or ⌘ to zoom, or use two fingers.

How does the camera move between levels?

The block keeps one aim, the world's frame or the lower 48's, and hands it to MapCamera, which flies to each new one (or jumps there when reduced motion is on). Choosing a place doesn't move the camera, so you never lose the level you're on; pan and zoom freely, and the next drill or the way back frames the level again.