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

<mth-waveform>

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

Accessible audio waveform visualizer and keyboard-scrubbable seekbar.

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

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/media/waveform"></script>
<mth-waveform current-time="0" duration="0"></mth-waveform>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
srcsrcstring""Media audio source URL validated against the safe URL allowlist.
playingplayingbooleanfalseWhether audio playback is currently active.
disableddisabledbooleanfalseDisables interactive scrubbing and playback controls.
currentTimecurrent-timenumber0Current playback time in seconds.
durationdurationnumber0Total media duration in seconds.
barCountbar-countnumber48Number of normalized amplitude bars rendered in the waveform.
labellabelstring""Accessible region label.
peaks—readonly number[]—Precomputed amplitude peak array (0..1).

Events

EventDetail TypeDescription
mth-play{ currentTime: number }Fired when playback starts.
mth-pause{ currentTime: number }Fired when playback pauses.
mth-seek{ currentTime: number; progress: number }Fired when the playback position changes.
mth-error{ reason: string }Fired when an invalid or unsafe source URL is rejected.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowRightltrFocus is on the waveform scrubberSeeks forward along the audio timeline
ArrowLeftltrFocus is on the waveform scrubberSeeks backward along the audio timeline
HomebothFocus is on the waveform scrubberSeeks to the start of the waveform
EndbothFocus is on the waveform scrubberSeeks to the end of the waveform
bothFocus is on the waveform scrubberToggles audio playback

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