← All Components
<mth-map-cluster>
Spatial point clustering layer over MapLibre with accessible cluster controls and zoom expansion.
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-cluster>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/maps/map-cluster"></script>
<mth-map-cluster radius="48" zoom="4"></mth-map-cluster>import '@methane-ui/maps/map-cluster';
import '@methane-ui/react';
export function Example() {
return <mth-map-cluster radius="48" zoom="4"></mth-map-cluster>;
}<script setup lang="ts">
import '@methane-ui/maps/map-cluster';
</script>
<template>
<mth-map-cluster radius="48" zoom="4"></mth-map-cluster>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/maps/map-cluster';
import { MthMapClusterDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthMapClusterDirective],
template: `<mth-map-cluster radius="48" zoom="4"></mth-map-cluster>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/maps/map-cluster';
import MthMapCluster from '@methane-ui/svelte/MthMapCluster.svelte';
</script>
<MthMapCluster radius="48" zoom="4"></MthMapCluster>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
points | — | ReadonlyArray<unknown> | — | Array of spatial cluster points (id, lng, lat, optional label). |
radius | radius | number | 48 | Spatial clustering bucket radius in pixels. |
zoom | zoom | number | 4 | Initial zoom level used for spatial bucketing. |
maxZoom | max-zoom | number | 18 | Zoom threshold above which individual points are rendered unclustered. |
label | label | string | "" | Accessible region label. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-cluster-expand | { clusterId: string; count: number; center: readonly [number, number]; zoom: number } | Fired when a multi-point cluster is expanded. |
mth-cluster-select | { point: unknown } | Fired when a single point cluster item is activated. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowLeft | ltr | cluster toolbar focused | Moves focus to previous cluster item |
| ArrowRight | ltr | cluster toolbar focused | Moves focus to next cluster item |
| Enter | both | cluster item focused | Expands focused cluster or selects point |
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-cluster.spec.test.ts |
| i18n | Routes 5 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |