Skip to main content
196

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
Data display

WorldMap

Highlights countries and labeled locations on a reusable animated dotted or solid world map.

FrameworksAstro · React · Elements

Registry commandlumen add WorldMap

InteractionEnhanced runtime

Explore navigation guidance and regional destination examples.

01

See it and copy it

Framework example

Choose Astro, React, or Elements to compare native usage against the shared visual output. Each example assumes the framework-level setup is already complete.

Dotted destinations

AstroCode target · live preview uses Astro

Places worth remembering

Your own destinations, your own colors. Sample data for this demo.

100%
  • Colombia
  • Japan
  • Portugal
  • Spain
  • United States
  • Brazil
  • Australia
  • Bogotá
  • Tokyo
  • Lisbon
Illustrative destinations. Hover over the map or choose a country to explore.
View WorldMap code

Framework usage

Switch targets to compare the adapter code. This live preview runs the Astro example. React and Elements use their own behavior APIs; complete the matching framework setup before copying an example.
astro
---
import { WorldMap } from '@santi020k/lumen-astro'
import { lumenWorldMapCountries } from '@santi020k/lumen-core/world-map-data'
---

<WorldMap
  caption="Illustrative destinations. Hover over the map or choose a country to explore."
  countries={lumenWorldMapCountries}
  description="Your own destinations, your own colors. Sample data for this demo."
  heading="Places worth remembering"
  highlightedCountries={['CO', 'JP', 'PT', 'ES', 'US', 'BR', 'AU']}
  label="World map showing sample destinations"
  markers={[
    { id: 'bogota', label: 'Bogotá', latitude: 4.71, longitude: -74.07 },
    { id: 'tokyo', label: 'Tokyo', latitude: 35.68, longitude: 139.69 },
    { id: 'lisbon', label: 'Lisbon', latitude: 38.72, longitude: -9.14 }
  ]}
/>
Edit WorldMap in browser

Solid regions

Use Lumen accent colors and country labels to match your product.

AstroCode target · live preview uses Astro
100%
  • Colombia
  • 日本
  • Portugal
Solid styling with Lumen accent colors and localized country labels.
View WorldMap code

Framework usage

Switch targets to compare the adapter code. This live preview runs the Astro example. React and Elements use their own behavior APIs; complete the matching framework setup before copying an example.
astro
---
import { WorldMap } from '@santi020k/lumen-astro'
import { lumenWorldMapCountries } from '@santi020k/lumen-core/world-map-data'
---

<WorldMap
  animated={false}
  caption="Solid styling with Lumen accent colors and localized country labels."
  countries={lumenWorldMapCountries}
  highlightedCountries={['CO', 'JP', 'PT']}
  label="Sample destinations with a solid map style"
  labels={{ CO: 'Colombia', JP: '日本', PT: 'Portugal' }}
  listLabel="Explore a country"
  style="--ui-world-map-highlight: hsl(var(--accent));"
  variant="solid"
/>
Edit WorldMap in browser
02

Choose your target

Add this component

Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.

bash@santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
bashAstro wrapper
lumen add WorldMap
lumen add WorldMap

API reference

Lumen-specific props and runtime attributes for the Astro primitive. Use the framework differences above and the copyable examples for React composition and Elements attributes; the public adapter types define their supported contracts.

AttributeValuesDefaultDescription
initialView"world" | "highlighted""world"Fits highlighted country geometry on enhancement. The Fit highlighted countries button repeats the fit; reset restores the world. Elements uses initial-view.
zoomablebooleantrueShows zoom, fit, and reset controls. Buttons use 50% steps from 100% to 800%. Ctrl/Cmd-scroll zooms toward the cursor; drag or scroll to explore.
zoomLabelsPartial<LumenWorldMapZoomLabels>English labelsLocalizes zoomIn, zoomOut, reset, level, fit and viewport. Elements accepts zoom-labels JSON.
countriesreadonly LumenWorldMapCountryGeometry[]requiredImport lumenWorldMapCountries explicitly from @santi020k/lumen-core/world-map-data. Custom geometry uses the fixed 1000 × 400 projection.
labelstringrequiredProvides the accessible name for the map image.
highlightedCountriesreadonly string[][]Country codes to highlight; unknown codes and duplicates are dropped. Elements also accepts highlighted-countries as JSON.
variant"dotted" | "solid""dotted"Chooses the map appearance.
markersreadonly LumenWorldMapMarker[][]Labeled points with id, latitude and longitude. Invalid or off-map points are dropped.
labels / listLabelRecord<string, string> / stringcountry names / "Choose a country"Localizes country names and the native chooser. Elements uses labels JSON and list-label.
selectedCountrystring-Initial selection in Astro, reflected selected-country in Elements, controlled selection in React; React also supports defaultSelectedCountry.
interactive / animatedbooleantrueEnable country selection and motion separately. Reduced motion disables animation automatically.
onCountrySelect(detail: LumenWorldMapSelectDetail) => void-React callback; Astro and Elements emit ui:world-map-select with countryId, highlighted and label.
heading / description / captionstring-Optional Astro and React figure content. Elements supports authored content outside the map.
CSS variables--ui-world-map-land / --ui-world-map-highlight / --ui-world-map-marker / --ui-world-map-surfacesemantic tokensAccept any CSS color to customize the map while preserving theme defaults.
class, classNamestring""Merges custom classes with the generated ui-* root classes.
...native attributesHTML attributes-Forwards standard attributes to the root element unless the component consumes them.

Keyboard interactions

Keyboard behavior provided by the Astro UIPrimitives runtime for this component.

KeyAction
TabFocus the native country chooser.
Arrow keysChoose a country using the native select.

Runtime events

CustomEvents dispatched by the Astro UIPrimitives runtime for this component.

EventTargetDetailWhen
ui:world-map-selectWorldMap root{ countryId: string, highlighted: boolean, label: string }A different country is selected by pointer or native chooser.

Web docsFull catalog