← All Components
<mth-schema-form>
Declarative JSON-Schema-subset form renderer emitting public <mth-field> and <mth-input> controls with schema constraint validation and FORM_CONTEXT propagation.
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-schema-form>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/schema-form"></script>
<mth-schema-form></mth-schema-form>import '@methane-ui/ui/schema-form';
import '@methane-ui/react';
export function Example() {
return <mth-schema-form></mth-schema-form>;
}<script setup lang="ts">
import '@methane-ui/ui/schema-form';
</script>
<template>
<mth-schema-form></mth-schema-form>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/schema-form';
import { MthSchemaFormDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthSchemaFormDirective],
template: `<mth-schema-form></mth-schema-form>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/schema-form';
import MthSchemaForm from '@methane-ui/svelte/MthSchemaForm.svelte';
</script>
<MthSchemaForm></MthSchemaForm>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
schemaJson | schema-json | string | "" | JSON-serialized form schema string for declarative HTML/SSR usage. |
submitLabel | submit-label | string | "" | Custom text for the submit button. |
showReset | show-reset | boolean | false | Renders a form reset button. |
disabled | disabled | boolean | false | Disables all generated fields and submission via FORM_CONTEXT. |
readonly | readonly | boolean | false | Propagates read-only state via FORM_CONTEXT. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-input | { values: Record<string, unknown>; valid: boolean } | Fired synchronously when any generated field updates. |
mth-change | { values: Record<string, unknown>; valid: boolean } | Fired when a field commits a value change. |
mth-submit | { values: Record<string, unknown>; valid: boolean } | Cancelable event fired when schema validation succeeds on submit. |
mth-invalid | { errors: Record<string, string> } | Fired on submit when schema constraint validation fails. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | focused inside form control | validates schema and dispatches mth-submit or mth-invalid |
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-schema-form.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(submitting), :state(invalid), :state(submitted). | Conformance suite |
| i18n | Routes 10 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |