← All Components
<mth-form>
Form coordinator providing FormContext to child controls, validating FACE elements, and emitting mth-submit / mth-invalid events.
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-form>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/form"></script>
<mth-form>Example</mth-form>import '@methane-ui/ui/form';
import '@methane-ui/react';
export function Example() {
return <mth-form>Example</mth-form>;
}<script setup lang="ts">
import '@methane-ui/ui/form';
</script>
<template>
<mth-form>Example</mth-form>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/form';
import { MthFormDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthFormDirective],
template: `<mth-form>Example</mth-form>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/form';
import MthForm from '@methane-ui/svelte/MthForm.svelte';
</script>
<MthForm>Example</MthForm>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
novalidate | novalidate | boolean | false | Bypasses constraint validation before emitting mth-submit. |
submitting | submitting | boolean | false | Marks the form as submitting and propagates disabled state via FormContext. |
disabled | disabled | boolean | false | Disables all enclosed form controls via FormContext. |
readonly | readonly | boolean | false | Propagates read-only state to enclosed form controls via FormContext. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-submit | { values: Record<string, string | ReadonlyArray<string>> } | Fired with serialized child control values when validation succeeds (or novalidate is set). |
mth-invalid | { errors: ReadonlyArray<{ readonly id: string; readonly name: string; readonly message: string; readonly label?: string }> } | Fired with collected control errors when submission validation fails. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | focus inside non-textarea single-line control | triggers form requestSubmit and validates child controls |
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 |
| keyboard | Implements all 1 APG keyboard transitions across LTR/RTL. | mth-form.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(submitting), :state(disabled), :state(readonly), :state(invalid). | Conformance suite |
| i18n | Routes 2 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |