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

<mth-form>

@methane-ui/ui~9.0 KB brotli (cold + Lit)~2.6 KB marginal

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

Interactive StageLive Custom Element · <mth-form> (@methane-ui/ui)
Astro SSR (DSD)Next.js 15 RSCNuxt 3 NitroSvelteKit 2Angular 19Save Configuration
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>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
novalidatenovalidatebooleanfalseBypasses constraint validation before emitting mth-submit.
submittingsubmittingbooleanfalseMarks the form as submitting and propagates disabled state via FormContext.
disableddisabledbooleanfalseDisables all enclosed form controls via FormContext.
readonlyreadonlybooleanfalsePropagates read-only state to enclosed form controls via FormContext.

Events

EventDetail TypeDescription
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

KeyDirectionWhenExpected Behavior
Enterbothfocus inside non-textarea single-line controltriggers form requestSubmit and validates child controls

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="none".lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 1 APG keyboard transitions across LTR/RTL.mth-form.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(submitting), :state(disabled), :state(readonly), :state(invalid).Conformance suite
i18nRoutes 2 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test