← All Components
<mth-map-draw>
Interactive GeoJSON drawing surface supporting points, lines, polygons, keyboard drawing, and undo/redo.
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-draw>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/maps/map-draw"></script>
<mth-map-draw mode="select"></mth-map-draw>import '@methane-ui/maps/map-draw';
import '@methane-ui/react';
export function Example() {
return <mth-map-draw mode="select"></mth-map-draw>;
}<script setup lang="ts">
import '@methane-ui/maps/map-draw';
</script>
<template>
<mth-map-draw mode="select"></mth-map-draw>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/maps/map-draw';
import { MthMapDrawDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthMapDrawDirective],
template: `<mth-map-draw mode="select"></mth-map-draw>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/maps/map-draw';
import MthMapDraw from '@methane-ui/svelte/MthMapDraw.svelte';
</script>
<MthMapDraw mode="select"></MthMapDraw>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
mode | mode | 'select' | 'point' | 'line' | 'polygon' | "point" | Active drawing mode (select, point, line, polygon). |
features | — | unknown | — | Current GeoJSON FeatureCollection. |
label | label | string | "" | Accessible region label. |
disabled | disabled | boolean | false | Disables toolbar controls and drawing input. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-draw-change | { features: unknown } | Fired when features are added, undone, redone, or cleared. |
mth-draw-mode | { mode: unknown } | Fired when the active drawing mode changes. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowLeft | ltr | toolbar focused | Moves focus to previous tool |
| ArrowRight | ltr | toolbar focused | Moves focus to next tool |
| Enter | both | tool focused | Activates focused drawing tool |
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 3 APG keyboard transitions across LTR/RTL. | mth-map-draw.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(disabled). | Conformance suite |
| i18n | Routes 12 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |