← All Components
<mth-inline-edit>
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
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>import '@methane-ui/ui/inline-edit';
import '@methane-ui/react';
export function Example() {
return <mth-inline-edit submit-on-blur></mth-inline-edit>;
}<script setup lang="ts">
import '@methane-ui/ui/inline-edit';
</script>
<template>
<mth-inline-edit submit-on-blur></mth-inline-edit>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/inline-edit';
import { MthInlineEditDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthInlineEditDirective],
template: `<mth-inline-edit submit-on-blur></mth-inline-edit>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/inline-edit';
import MthInlineEdit from '@methane-ui/svelte/MthInlineEdit.svelte';
</script>
<MthInlineEdit submit-on-blur></MthInlineEdit>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
value | value | string | "" | Committed string value submitted with the parent <form>. |
name | name | string | "" | Form control field name. |
label | label | string | "" | Accessible label for the display trigger and inline input. |
placeholder | placeholder | string | "" | Placeholder shown when value is empty. |
editing | editing | boolean | false | Whether the inline text input is currently active. |
disabled | disabled | boolean | false | Disables activation and editing. |
readonly | readonly | boolean | false | Prevents entering edit mode while keeping value readable. |
required | required | boolean | false | Marks a non-empty value as required for FACE constraint validation. |
submitOnBlur | submit-on-blur | boolean | true | Commits draft value automatically when the inline input loses focus. |
Events
| Event | Detail Type | Description |
|---|---|---|
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
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | Display trigger is focused | Enters edit mode and focuses text input |
| Enter | both | Inline input is focused | Commits draft value, emits mth-change, exits edit mode, and returns focus to trigger |
| Escape | both | Inline input is focused | Discards draft, emits mth-cancel, exits edit mode, and restores focus to trigger |
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-inline-edit.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(editing), :state(disabled), :state(readonly), :state(dirty), :state(touched), :state(invalid). | Conformance suite |
| i18n | Routes 2 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |