← All Components
<mth-countdown>
Live countdown timer using <time datetime> ISO-8601 duration markup, tabular numerals, idempotent timer lifecycle cleanup, and throttled polite live 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
Ready · interact with <mth-countdown>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/countdown"></script>
<mth-countdown duration="0" running></mth-countdown>import '@methane-ui/ui/countdown';
import '@methane-ui/react';
export function Example() {
return <mth-countdown duration="0" running></mth-countdown>;
}<script setup lang="ts">
import '@methane-ui/ui/countdown';
</script>
<template>
<mth-countdown duration="0" running></mth-countdown>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/countdown';
import { MthCountdownDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthCountdownDirective],
template: `<mth-countdown duration="0" running></mth-countdown>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/countdown';
import MthCountdown from '@methane-ui/svelte/MthCountdown.svelte';
</script>
<MthCountdown duration="0" running></MthCountdown>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
target | target | string | "" | Target ISO-8601 timestamp string to count down toward. |
duration | duration | number | 0 | Duration in seconds used when target is omitted. |
running | running | boolean | true | Starts or pauses the active countdown interval. |
precision | precision | 'seconds' | 'minutes' | "seconds" | Smallest displayed time unit (seconds or minutes). |
format | format | 'hms' | 'dhms' | "dhms" | Display segmentation (dhms includes days; hms rolls days into hours). |
announceInterval | announce-interval | number | 30 | Seconds between polite screen-reader announcements while running (0 announces only completion). |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-tick | { remainingMs: number; days: number; hours: number; minutes: number; seconds: number } | Emitted on each interval tick with remaining duration breakdown. |
mth-complete | { target: string } | Emitted once when remaining time reaches zero. |
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 |
| states | Exposes ElementInternals CustomStateSet flags: :state(running), :state(complete). | Conformance suite |
| i18n | Routes 6 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |