← All Components
<mth-coachmark>
Anchored feature-discovery coachmark popover using OverlayController and PositioningController with optional beacon and step counter.
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-coachmark>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/coachmark"></script>
<mth-coachmark placement="top" beacon>Example</mth-coachmark>import '@methane-ui/ui/coachmark';
import '@methane-ui/react';
export function Example() {
return <mth-coachmark placement="top" beacon>Example</mth-coachmark>;
}<script setup lang="ts">
import '@methane-ui/ui/coachmark';
</script>
<template>
<mth-coachmark placement="top" beacon>Example</mth-coachmark>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/coachmark';
import { MthCoachmarkDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthCoachmarkDirective],
template: `<mth-coachmark placement="top" beacon>Example</mth-coachmark>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/coachmark';
import MthCoachmark from '@methane-ui/svelte/MthCoachmark.svelte';
</script>
<MthCoachmark placement="top" beacon>Example</MthCoachmark>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
open | open | boolean | false | Controls whether the coachmark is visible. |
target | target | string | "" | CSS selector resolving the anchor element in the document. |
heading | heading | string | "" | Title text rendered in the coachmark header. |
placement | placement | 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end' | "bottom" | Preferred placement relative to the target element. |
beacon | beacon | boolean | true | Displays an attention beacon indicator. |
closable | closable | boolean | true | Renders the header close icon button. |
dismissLabel | dismiss-label | string | "" | Custom label for the primary dismiss button. |
step | step | number | 0 | Optional 1-based step index shown in the footer. |
total | total | number | 0 | Optional total number of steps shown alongside step. |
forceFallback | force-fallback | boolean | false | Forces JavaScript positioning fallback for deterministic testing. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-open | undefined | Cancelable event fired before opening. |
mth-after-open | undefined | Fired after opening. |
mth-close | { reason: string } | Cancelable event fired before closing. |
mth-after-close | undefined | Fired after closing. |
mth-dismiss | undefined | Fired when dismissed via the primary acknowledgement CTA. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Escape | both | open | Dismisses the coachmark and restores focus. |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="none". | 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-coachmark.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(open), :state(beacon). | Conformance suite |
| i18n | Routes 4 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |