Components/Charts/MapLegend

MapLegend

Charts

HUD-style legend block for maps — ramp, vertical ramp, or categorical swatches.

Swatch block that reads like a HUD readout. Three variants (ramp, rampVertical, categorical) cover the common cases for every World* component. Pair with WorldChoropleth, WorldHeatmap, or WorldBubbleMap when you need a standalone legend.

Import

import { MapLegend } from "nosible-ux"

Examples

Horizontal ramp

GDP
07142128

Categorical swatches

Region
  • Americas
  • Europe
  • APAC
  • MENA

Vertical ramp

Density
LowMedHigh

Accessibility

The wrapper renders with role="group" and an automatic aria-label derived from title. Colour-coded categories are announced by their text labels so the legend remains readable when contrast or colour differentiation is impaired.

Props

Name TypeDefaultDescription
height
number | undefinedVertical ramp height in px. Default: `140`.
items
MapLegendCategoricalItem[] | undefinedCategorical swatches — required when `variant="categorical"`.
stops
string[] | undefinedColour stops for ramp variants. Interpolated linearly.
ticks
string[] | undefinedTick labels rendered beside/under the ramp. Evenly distributed.
title
string | undefinedTitle rendered above the swatch in uppercase Space Mono.
variant
MapLegendVariant | undefinedLegend layout. Default: `"ramp"`.
width
number | undefinedRamp width in px. Default: `200`.