← All Components
<mth-map-route>
Route path visualizer computing Haversine distance and interactive bounds fitting across ordered stops.
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-route>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/maps/map-route"></script>
<mth-map-route unit="km"></mth-map-route>import '@methane-ui/maps/map-route';
import '@methane-ui/react';
export function Example() {
return <mth-map-route unit="km"></mth-map-route>;
}<script setup lang="ts">
import '@methane-ui/maps/map-route';
</script>
<template>
<mth-map-route unit="km"></mth-map-route>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/maps/map-route';
import { MthMapRouteDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthMapRouteDirective],
template: `<mth-map-route unit="km"></mth-map-route>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/maps/map-route';
import MthMapRoute from '@methane-ui/svelte/MthMapRoute.svelte';
</script>
<MthMapRoute unit="km"></MthMapRoute>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
origin | — | unknown | null | null | Starting route waypoint (lng, lat, optional label). |
destination | — | unknown | null | null | Ending route waypoint (lng, lat, optional label). |
waypoints | — | ReadonlyArray<unknown> | — | Intermediate ordered route waypoints. |
unit | unit | 'km' | 'mi' | "km" | Distance unit displayed in the summary (km or mi). |
label | label | string | "" | Accessible region label. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-route-fit | { bounds: unknown; distanceKm: number } | Fired when bounds are fitted across route stops. |
mth-waypoint-select | { waypoint: unknown; index: number } | Fired when a route stop button is selected. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | stop button focused | Centers map on selected route stop |
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 1 APG keyboard transitions across LTR/RTL. | mth-map-route.spec.test.ts |
| i18n | Routes 9 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |