← All Components
<mth-form-repeater>
Form-associated repeatable field row list with dynamic add/remove controls, min/max cardinality bounds, and accessible drag/keyboard reordering via DragSortController.
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-repeater>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/form-repeater"></script>
<mth-form-repeater min="0" reorderable></mth-form-repeater>import '@methane-ui/ui/form-repeater';
import '@methane-ui/react';
export function Example() {
return <mth-form-repeater min="0" reorderable></mth-form-repeater>;
}<script setup lang="ts">
import '@methane-ui/ui/form-repeater';
</script>
<template>
<mth-form-repeater min="0" reorderable></mth-form-repeater>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/form-repeater';
import { MthFormRepeaterDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthFormRepeaterDirective],
template: `<mth-form-repeater min="0" reorderable></mth-form-repeater>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/form-repeater';
import MthFormRepeater from '@methane-ui/svelte/MthFormRepeater.svelte';
</script>
<MthFormRepeater min="0" reorderable></MthFormRepeater>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
value | value | string | "" | Serialized JSON array string of row objects. |
name | name | string | "" | Form submission field name. |
label | label | string | "" | Accessible fieldset legend. |
hint | hint | string | "" | Helper text displayed below repeater. |
error | error | string | "" | Explicit custom error message. |
min | min | number | 0 | Minimum required row count. |
max | max | number | undefined | — | Maximum allowed row count. |
reorderable | reorderable | boolean | true | Enables pointer and keyboard row reordering. |
addLabel | add-label | string | "" | Custom label for the add row button. |
disabled | disabled | boolean | false | Disables adding, removing, editing, and reordering. |
required | required | boolean | false | Marks repeater required. |
readonly | readonly | boolean | false | Prevents structural or value modifications. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-input | { value: string; items: unknown[] } | Fired when any row value or ordering changes. |
mth-change | { value: string; items: unknown[] } | Fired when row changes commit. |
mth-add | { index: number; row: unknown } | Fired when a new row is appended. |
mth-remove | { index: number; row: unknown } | Fired when a row is removed. |
mth-reorder | { fromIndex: number; toIndex: number; item: HTMLElement } | Fired by DragSortController when a row moves. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Space | both | drag handle focused | toggles keyboard drag grab state for row reordering |
| ArrowUp | both | row grabbed in DragSortController | moves row earlier in list and emits mth-reorder |
| ArrowDown | both | row grabbed in DragSortController | moves row later in list and emits mth-reorder |
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 3 APG keyboard transitions across LTR/RTL. | mth-form-repeater.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(dirty), :state(touched), :state(user-invalid), :state(disabled), :state(required), :state(readonly). | Conformance suite |
| i18n | Routes 9 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |