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

<mth-prompt-input>

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

IME-safe auto-sizing AI prompt composer with FormControlController integration, Enter/Mod+Enter submission, and stop-generation state.

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-prompt-input> (@methane-ui/ai)
Model: Methane-Fast
Ready · interact with <mth-prompt-input>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ai/prompt-input"></script>
<mth-prompt-input submit-on-enter max-rows="6"></mth-prompt-input>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
valuevaluestring""Current prompt text value.
namenamestring""Form field name submitted via ElementInternals.
labellabelstring""Accessible field label.
placeholderplaceholderstring""Textarea placeholder text.
hinthintstring""Optional helper text displayed below the composer.
errorerrorstring""Explicit error text displayed when invalid.
disableddisabledbooleanfalseDisables prompt input and submission.
requiredrequiredbooleanfalseMarks the prompt as required for form validation.
streamingstreamingbooleanfalseSwitches the primary control into stop-generation mode.
submitOnEntersubmit-on-enterbooleantrueWhen true, Enter submits and Shift+Enter adds a newline; when false, Mod+Enter submits.
maxRowsmax-rowsnumber6Maximum visible auto-sized row count.

Events

EventDetail TypeDescription
mth-input{ value: string }Fired as the user types prompt text (after IME composition ends).
mth-change{ value: string }Fired when the prompt input commits on blur/change.
mth-submit{ value: string }Cancelable event fired when submitting the prompt.
mth-stopvoidFired when the user activates the stop-generation button.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
Enterbothfocused and submitOnEnter is true without Shift or IME compositionemits cancelable mth-submit with current value

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 1 APG keyboard transitions across LTR/RTL.mth-prompt-input.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(disabled), :state(streaming), :state(invalid), :state(dirty), :state(touched), :state(empty).Conformance suite
i18nRoutes 7 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test