← All Components
<mth-duration-input>
Form-associated segmented hours/minutes/seconds duration input outputting ISO 8601 PT#H#M#S durations.
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-duration-input>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/duration-input"></script>
<mth-duration-input show-seconds></mth-duration-input>import '@methane-ui/ui/duration-input';
import '@methane-ui/react';
export function Example() {
return <mth-duration-input show-seconds></mth-duration-input>;
}<script setup lang="ts">
import '@methane-ui/ui/duration-input';
</script>
<template>
<mth-duration-input show-seconds></mth-duration-input>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/duration-input';
import { MthDurationInputDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthDurationInputDirective],
template: `<mth-duration-input show-seconds></mth-duration-input>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/duration-input';
import MthDurationInput from '@methane-ui/svelte/MthDurationInput.svelte';
</script>
<MthDurationInput show-seconds></MthDurationInput>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
value | value | string | "" | Duration in ISO 8601 format (e.g. PT1H30M0S) or HH:MM:SS. |
name | name | string | "" | Form field name. |
label | label | string | "" | Accessible field label. |
showSeconds | show-seconds | boolean | true | Displays the seconds segment. |
disabled | disabled | boolean | false | Disables interaction. |
readonly | readonly | boolean | false | Prevents changing duration segments. |
required | required | boolean | false | Marks a non-empty duration value as required. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-change | { value: string; totalSeconds: number } | Fired when any duration segment changes. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowUp | both | Hours, minutes, or seconds segment is focused | Increments segment and updates ISO duration value |
| ArrowDown | both | Hours, minutes, or seconds segment is focused | Decrements segment and updates ISO duration value |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | delegatesFocus: true with zero host internals.role (ADR-014). | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 2 APG keyboard transitions across LTR/RTL. | mth-duration-input.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(disabled), :state(readonly), :state(dirty), :state(touched), :state(invalid). | Conformance suite |
| i18n | Routes 4 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |