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

<mth-stopwatch>

@methane-ui/ui~6.8 KB brotli (cold + Lit)~1.4 KB marginal

Interactive stopwatch with Start/Pause/Lap/Reset controls, tabular-numeral <time> display, clean interval teardown on disconnect, and discrete polite live-region announcements.

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-stopwatch> (@methane-ui/ui)
Ready · interact with <mth-stopwatch>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/stopwatch"></script>
<mth-stopwatch show-milliseconds></mth-stopwatch>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
runningrunningbooleanfalseIndicates or controls whether the stopwatch is currently timing.
showMillisecondsshow-millisecondsbooleantrueDisplays centiseconds/milliseconds fraction when true.
disableddisabledbooleanfalseDisables all stopwatch controls.

Events

EventDetail TypeDescription
mth-start{ elapsedMs: number }Emitted when timing begins or resumes.
mth-pause{ elapsedMs: number }Emitted when timing pauses.
mth-reset{ elapsedMs: number }Emitted when elapsed time and laps are cleared.
mth-lap{ index: number; lapMs: number; totalMs: number }Emitted when a lap split is recorded.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
EnterbothStart/Pause, Lap, or Reset button is focusedActivates the focused stopwatch control

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 1 APG keyboard transitions across LTR/RTL.mth-stopwatch.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(running), :state(disabled).Conformance suite
i18nRoutes 6 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test