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

<mth-search-input>

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

Form-associated search field with debounced query emission, instant Enter search, accessible clear button, and keyboard shortcut hint.

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

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/search-input"></script>
<mth-search-input debounce="300" clearable></mth-search-input>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
valuevaluestring""Current search query string.
namenamestring""Form submission field name.
labellabelstring""Accessible label rendered inside shadow root.
hinthintstring""Helper text displayed below the control.
errorerrorstring""Explicit validation error message.
placeholderplaceholderstring""Placeholder displayed when empty.
autocompleteautocompletestring""HTML autocomplete attribute forwarded to the search input.
shortcutshortcutstring""Visual keyboard shortcut badge shown when empty (e.g. "⌘K").
debouncedebouncenumber300Debounce delay in milliseconds before emitting mth-search.
clearableclearablebooleantrueRenders a clear button and enables Escape-to-clear when non-empty.
disableddisabledbooleanfalseDisables user interaction.
requiredrequiredbooleanfalseMarks search input required.
readonlyreadonlybooleanfalsePrevents edits while preserving focus and submission.

Events

EventDetail TypeDescription
mth-input{ value: string }Fired on query edits.
mth-change{ value: string }Fired when query commits.
mth-search{ value: string }Fired after debounce on edits, immediately on Enter, or upon clear.
mth-clearRecord<string, never>Fired when the user clears the query.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
Enterbothinput focused and not composing IMEemits immediate mth-search event
Escapebothclearable and value non-emptyclears query and emits mth-clear and mth-search

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