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

<mth-inline-edit>

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

Form-associated click-to-edit inline text field with Enter commit, Escape revert, and focus restoration.

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-inline-edit> (@methane-ui/ui)
Ready · interact with <mth-inline-edit>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/inline-edit"></script>
<mth-inline-edit submit-on-blur></mth-inline-edit>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
valuevaluestring""Committed string value submitted with the parent <form>.
namenamestring""Form control field name.
labellabelstring""Accessible label for the display trigger and inline input.
placeholderplaceholderstring""Placeholder shown when value is empty.
editingeditingbooleanfalseWhether the inline text input is currently active.
disableddisabledbooleanfalseDisables activation and editing.
readonlyreadonlybooleanfalsePrevents entering edit mode while keeping value readable.
requiredrequiredbooleanfalseMarks a non-empty value as required for FACE constraint validation.
submitOnBlursubmit-on-blurbooleantrueCommits draft value automatically when the inline input loses focus.

Events

EventDetail TypeDescription
mth-edit-start{ value: string }Cancelable event fired before entering edit mode.
mth-input{ value: string }Fired as the draft input text changes.
mth-change{ value: string }Fired when an edited value is committed.
mth-cancel{ value: string }Fired when editing is cancelled via Escape.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
EnterbothDisplay trigger is focusedEnters edit mode and focuses text input
EnterbothInline input is focusedCommits draft value, emits mth-change, exits edit mode, and returns focus to trigger
EscapebothInline input is focusedDiscards draft, emits mth-cancel, exits edit mode, and restores focus to trigger

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-inline-edit.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(editing), :state(disabled), :state(readonly), :state(dirty), :state(touched), :state(invalid).Conformance suite
i18nRoutes 2 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test