caliper uidocs

Choropleth

Pro

A map shaded by value per region.

Installs components/ui/choropleth.tsxDepends on d3-shapeMotion shared motion tokens
pnpm dlx shadcn@latest add @caliper/choropleth
Adoption rate by state
1880
  1. 1Kansas80
  2. 2Hawaii79
  3. 3Alabama75

Adoption rate by state
RegionValue
Kansas80
Hawaii79
Alabama75
Ohio74
West Virginia73
New York71
Wyoming71
Colorado70
New Hampshire68
Minnesota68
Washington DC68
Washington65
Arkansas65
Florida63
Georgia60
Pennsylvania59
Virginia58
Oklahoma57
Rhode Island56
South Dakota56
Nebraska55
Illinois53
Maine50
Idaho50
Tennessee50
Arizona47
New Jersey44
Maryland43
Louisiana42
Massachusetts41
Iowa41
Missouri40
Wisconsin38
Oregon38
California37
Montana35
North Carolina35
Texas34
New Mexico32
Connecticut29
Delaware28
Mississippi27
Indiana26
Kentucky25
Michigan23
Nevada23
Utah22
Vermont20
North Dakota20
South Carolina20
Alaska18

When to use #

Use it for

  • Comparing regions.

Skip it when

  • Exact values matter more than pattern.

Installation #

terminal
pnpm dlx shadcn@latest add @caliper/choropleth

Adds its 3 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage #

Import it from your copy of the source. The example behind the preview comes with the source.

example.tsx
import { Choropleth } from "@/components/ui/choropleth"

The worked example comes with Pro

The 22-line example behind the preview opens here with a Pro or Team licence.

Checking your licence…

API reference #

Choropleth

component
PropTypeDefault
label *string—
regions *readonly Region[]—
unitstring""
format((n: number) => string)(n) => n.toLocaleString("en-US")
classNamestring—

Accessibility #

It exposes group, img and status semantics, with aria-label kept in step with state. Changes that matter are announced through a live region.

KeyBehaviour
→Moves to the next item or value.
←Moves to the previous item or value.
↓Moves to the next item or value.
↑Moves to the previous item or value.

Motion #

Transitions use the shared duration and easing tokens. Under prefers-reduced-motion those tokens collapse to instant and travel distances go to zero, so state changes still happen without movement.