Skip to content

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

Route Map

Routes out of four hub airports as great circles, wider where more passengers fly. This is the React version, drawn with TanStack Charts.

Charting library: TanStack Charts

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

Usage

import { ChartRouteMapDefault } from "@/components/charts/chart-route-map-default";
<ChartRouteMapDefault />

API Reference

RouteMapChart

PropType
dataRouteMapData

The places and the routes between them. A route naming a place that isn't there is left out.

geography?FeatureCollection<Geometry, Readonly<Record<string, unknown>> | null>

The countries to draw under the routes (GeoJSON; RouteMapLand styles them), such as the kit's worldCountries.

Type
FeatureCollection<Geometry, Readonly<Record<string, unknown>> | null>
projection?SpatialProjection

The map projection.

Default
"equal-earth"
rotate?readonly [number, number]

Rotation of the projection, [longitude, latitude] in degrees.

fit?"sphere" | "geography" | "data"

What fills the plot: the whole world, the geography's features, or the places (a region's routes).

Type
"sphere" | "geography" | "data"
Default
"sphere"
aspectRatio?string

Aspect ratio of the chart as "width / height".

Default
"2 / 1"
margin?Partial<SpatialMargin>

Space around the plot in pixels. Any side you omit keeps its default.

Type
Partial<SpatialMargin>
animate?boolean

Play the entrance animation.

Default
true
animationDuration?number

Length of the entrance sweep in milliseconds: the time from the first mark starting to the last one.

Default
900
revealSignature?string

Changing this value replays the entrance animation.

status?ChartStatus

"loading" draws a pulsing skeleton of the chart's shape in place of its marks (the axes, grid and land stay) and ignores the pointer; switching to "ready" plays the entrance.

Default
"ready"
loadingLabel?string

Text shown centered over the chart, with a shimmer, while status is "loading". Nothing is shown when it is unset or empty.

className?string

Additional class name for the chart container.

children?ReactNode

The chart's carriers: its layers, axes, grid, tooltip and legend.

ariaLabel?string

Accessible label of the chart.

ariaDescription?string

Longer accessible description of the chart.

RouteMapGraticule

PropType
outline?boolean

Draw the world's outline too.

Default
true
step?readonly [number, number]

Degrees between the lines, [longitude, latitude].

Default
[20, 20]
stroke?string

Color of the lines.

Default
"var(--chart-graticule)"
strokeWidth?number

Width of the lines, in pixels.

Default
0.5

RouteMapLand

PropType
fill?string

Fill of the land.

Default
"var(--muted)"
stroke?string

Color of the borders between countries.

Default
"var(--chart-background)"
strokeWidth?number

Width of the borders, in pixels.

Default
0.5

RouteMapRoutes

PropType
color?string

Color of the routes.

Default
"var(--chart-1)"
colorKey?string

Key of each route's category: each category takes the palette in order of appearance (--chart-1, --chart-2…).

widthRange?readonly [number, number]

Width of the lightest and the heaviest route, in pixels (by value).

Default
[1, 4]
opacity?number

Opacity of the routes at rest.

Default
0.8
inactiveOpacity?number

Opacity of the other marks while one is hovered or focused.

Default
0.25
fadeOnHover?boolean

Dim the layer's other marks while one is hovered or focused.

Default
true

RouteMapPlaces

PropType
radius?number

Radius of the dots, in pixels.

Default
3.5
color?string

Fill of the dots.

Default
"var(--chart-foreground)"

RouteMapTooltip

PropType
content?(args: RouteMapTooltipArgs) => ReactNode

Custom tooltip content. Replaces the default title and rows, inside the same panel.

Type
(args: RouteMapTooltipArgs) => ReactNode
formatValue?(value: number) => string

Formats the value row of the default content.

Type
(value: number) => string
Default
the number with thousands separators
valueLabel?string

The label of the value row of the default content.

className?string

Additional class name for the tooltip panel.

panelStyle?CSSProperties

Inline styles merged onto the tooltip panel.

backgroundColor?string

Background color of the tooltip panel. Overrides the theme's popover color.