← All Components
<mth-map>
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
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>import '@methane-ui/maps/map';
import '@methane-ui/react';
export function Example() {
return <mth-map center-lat="37.7749" center-lng="-122.4194">Example</mth-map>;
}<script setup lang="ts">
import '@methane-ui/maps/map';
</script>
<template>
<mth-map center-lat="37.7749" center-lng="-122.4194">Example</mth-map>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/maps/map';
import { MthMapDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthMapDirective],
template: `<mth-map center-lat="37.7749" center-lng="-122.4194">Example</mth-map>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/maps/map';
import MthMap from '@methane-ui/svelte/MthMap.svelte';
</script>
<MthMap center-lat="37.7749" center-lng="-122.4194">Example</MthMap>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
centerLat | center-lat | number | 37.7749 | Viewport center latitude in decimal degrees. |
centerLng | center-lng | number | -122.4194 | Viewport center longitude in decimal degrees. |
zoom | zoom | number | 11 | Current map zoom level. |
minZoom | min-zoom | number | 0 | Minimum allowed zoom level. |
maxZoom | max-zoom | number | 22 | Maximum allowed zoom level. |
bearing | bearing | number | 0 | Map bearing rotation in degrees. |
pitch | pitch | number | 0 | Map tilt pitch in degrees. |
interactive | interactive | boolean | true | Enables interactive pan/zoom controls and keyboard navigation. |
label | label | string | "" | 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
| Event | Detail Type | Description |
|---|---|---|
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
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowLeft | ltr | viewport focused | Pans map west |
| ArrowRight | rtl | viewport focused | Pans map west in RTL |
| ArrowUp | both | viewport focused | Pans map north |
| ArrowDown | both | viewport focused | Pans map south |
| + | both | viewport focused | Zooms in by 1 level |
| - | both | viewport focused | Zooms out by 1 level |
| Home | both | viewport focused | Resets map view |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="host". | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 7 APG keyboard transitions across LTR/RTL. | mth-map.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(interactive). | Conformance suite |
| i18n | Routes 8 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |