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

<mth-form-repeater>

@methane-ui/ui~10.1 KB brotli (cold + Lit)~3.2 KB marginal

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

Interactive StageLive Custom Element · <mth-form-repeater> (@methane-ui/ui)
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>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
valuevaluestring""Serialized JSON array string of row objects.
namenamestring""Form submission field name.
labellabelstring""Accessible fieldset legend.
hinthintstring""Helper text displayed below repeater.
errorerrorstring""Explicit custom error message.
minminnumber0Minimum required row count.
maxmaxnumber | undefined—Maximum allowed row count.
reorderablereorderablebooleantrueEnables pointer and keyboard row reordering.
addLabeladd-labelstring""Custom label for the add row button.
disableddisabledbooleanfalseDisables adding, removing, editing, and reordering.
requiredrequiredbooleanfalseMarks repeater required.
readonlyreadonlybooleanfalsePrevents structural or value modifications.

Events

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

KeyDirectionWhenExpected Behavior
Spacebothdrag handle focusedtoggles keyboard drag grab state for row reordering
ArrowUpbothrow grabbed in DragSortControllermoves row earlier in list and emits mth-reorder
ArrowDownbothrow grabbed in DragSortControllermoves row later in list and emits mth-reorder

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusdelegatesFocus: true with zero host internals.role (ADR-014).lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 3 APG keyboard transitions across LTR/RTL.mth-form-repeater.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(dirty), :state(touched), :state(user-invalid), :state(disabled), :state(required), :state(readonly).Conformance suite
i18nRoutes 9 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test