Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-image-annotator>

@methane-ui/media~7.9 KB brotli shell + lazy engine~2.0 KB shell · lazy engine chunk

Accessible SVG image annotator supporting rectangle, arrow, text, and freehand vector annotations with 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

Interactive StageLive Custom Element · <mth-image-annotator> (@methane-ui/media)
Ready · interact with <mth-image-annotator>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/media/image-annotator"></script>
<mth-image-annotator tool="rect"></mth-image-annotator>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
srcsrcstring""Image source URL validated against the safe URL allowlist.
altaltstring""Accessible alternative text for the image.
tooltool'rect' | 'arrow' | 'text' | 'freehand'"rect"Active drawing tool (rect, arrow, text, or freehand).
disableddisabledbooleanfalseDisables all toolbar and annotation interactions.
readonlyreadonlybooleanfalsePrevents mutating or adding annotations while allowing inspection.
labellabelstring""Accessible region label.
annotations—readonly unknown[]—Vector annotation list rendered over the image.

Events

EventDetail TypeDescription
mth-annotation-add{ annotation: unknown }Fired when a new vector annotation is added.
mth-annotation-change{ annotations: unknown[] }Fired when annotations change via add, remove, undo, redo, or clear.
mth-annotation-select{ id: string | null }Fired when an annotation item is selected.
mth-tool-change{ tool: unknown }Fired when the active drawing tool changes.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowRightltrFocus is on an annotation list itemMoves focus to the next annotation item
ArrowLeftltrFocus is on an annotation list itemMoves focus to the previous annotation item
DeletebothFocus is on an editable annotation itemRemoves the focused annotation

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusdelegatesFocus: true with zero host internals.role (ADR-014).lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 3 APG keyboard transitions across LTR/RTL.mth-image-annotator.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(disabled), :state(readonly).Conformance suite
i18nRoutes 12 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test