Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-map>

@methane-ui/maps~6.8 KB brotli shell + lazy engine~1.4 KB shell · lazy engine chunk

Interactive MapLibre GL JS map canvas with RTL-aware panning, zoom controls, markers, and SSR fallback.

When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.

Live Interactive Preview

Interactive StageLive Custom Element · <mth-map> (@methane-ui/maps)
Ready · interact with <mth-map>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/maps/map"></script>
<mth-map center-lat="37.7749" center-lng="-122.4194">Example</mth-map>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
centerLatcenter-latnumber37.7749Viewport center latitude in decimal degrees.
centerLngcenter-lngnumber-122.4194Viewport center longitude in decimal degrees.
zoomzoomnumber11Current map zoom level.
minZoommin-zoomnumber0Minimum allowed zoom level.
maxZoommax-zoomnumber22Maximum allowed zoom level.
bearingbearingnumber0Map bearing rotation in degrees.
pitchpitchnumber0Map tilt pitch in degrees.
interactiveinteractivebooleantrueEnables interactive pan/zoom controls and keyboard navigation.
labellabelstring""Accessible region label for the map.
mapStyle—string | unknown | undefined—Safe HTTP/HTTPS/relative style URL or MapLibre StyleSpecification object.
markers—ReadonlyArray<unknown>—Array of interactive markers plotted inside the map viewport.

Events

EventDetail TypeDescription
mth-map-move{ center: readonly [number, number]; zoom: number }Fired after programmatic, button, or keyboard pan/zoom view changes.
mth-marker-select{ id: string; lng: number; lat: number; label: string }Fired when an interactive map marker is activated.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowLeftltrviewport focusedPans map west
ArrowRightrtlviewport focusedPans map west in RTL
ArrowUpbothviewport focusedPans map north
ArrowDownbothviewport focusedPans map south
+bothviewport focusedZooms in by 1 level
-bothviewport focusedZooms out by 1 level
Homebothviewport focusedResets map view

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="host".lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 7 APG keyboard transitions across LTR/RTL.mth-map.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(interactive).Conformance suite
i18nRoutes 8 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test