← All Components
<mth-clock>
Localized digital and analog <time> clock component powered by FormattingUtils with optional time-zone, fixed SSR-safe value snapshot, and automatic interval teardown.
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-clock>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/clock"></script>
<mth-clock variant="digital" show-seconds></mth-clock>import '@methane-ui/ui/clock';
import '@methane-ui/react';
export function Example() {
return <mth-clock variant="digital" show-seconds></mth-clock>;
}<script setup lang="ts">
import '@methane-ui/ui/clock';
</script>
<template>
<mth-clock variant="digital" show-seconds></mth-clock>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/clock';
import { MthClockDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthClockDirective],
template: `<mth-clock variant="digital" show-seconds></mth-clock>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/clock';
import MthClock from '@methane-ui/svelte/MthClock.svelte';
</script>
<MthClock variant="digital" show-seconds></MthClock>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
value | value | string | "" | Optional fixed ISO-8601 timestamp or HH:MM[:SS] value (disables live clock ticking). |
timeZone | time-zone | string | "" | Optional IANA time zone (e.g. UTC, America/New_York). |
locale | locale | string | "" | BCP-47 locale override for localized digital time formatting. |
variant | variant | 'digital' | 'analog' | 'both' | "both" | Presentation mode (digital, analog, or both). |
hour12 | hour-12 | boolean | false | Uses 12-hour cycle when true (false uses locale/24-hour formatting). |
showSeconds | show-seconds | boolean | true | Displays seconds in digital readout and analog second hand. |
live | live | boolean | true | Automatically updates once per second when connected and no value is set. |
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(live). | Conformance suite |
| i18n | Routes 1 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |