← All Components
<mth-search-input>
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
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>import '@methane-ui/ui/search-input';
import '@methane-ui/react';
export function Example() {
return <mth-search-input debounce="300" clearable></mth-search-input>;
}<script setup lang="ts">
import '@methane-ui/ui/search-input';
</script>
<template>
<mth-search-input debounce="300" clearable></mth-search-input>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/search-input';
import { MthSearchInputDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthSearchInputDirective],
template: `<mth-search-input debounce="300" clearable></mth-search-input>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/search-input';
import MthSearchInput from '@methane-ui/svelte/MthSearchInput.svelte';
</script>
<MthSearchInput debounce="300" clearable></MthSearchInput>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
value | value | string | "" | Current search query string. |
name | name | string | "" | Form submission field name. |
label | label | string | "" | Accessible label rendered inside shadow root. |
hint | hint | string | "" | Helper text displayed below the control. |
error | error | string | "" | Explicit validation error message. |
placeholder | placeholder | string | "" | Placeholder displayed when empty. |
autocomplete | autocomplete | string | "" | HTML autocomplete attribute forwarded to the search input. |
shortcut | shortcut | string | "" | Visual keyboard shortcut badge shown when empty (e.g. "⌘K"). |
debounce | debounce | number | 300 | Debounce delay in milliseconds before emitting mth-search. |
clearable | clearable | boolean | true | Renders a clear button and enables Escape-to-clear when non-empty. |
disabled | disabled | boolean | false | Disables user interaction. |
required | required | boolean | false | Marks search input required. |
readonly | readonly | boolean | false | Prevents edits while preserving focus and submission. |
Events
| Event | Detail Type | Description |
|---|---|---|
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-clear | Record<string, never> | Fired when the user clears the query. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | input focused and not composing IME | emits immediate mth-search event |
| Escape | both | clearable and value non-empty | clears query and emits mth-clear and mth-search |
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 2 APG keyboard transitions across LTR/RTL. | mth-search-input.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(dirty), :state(touched), :state(user-invalid), :state(disabled), :state(required), :state(readonly). | Conformance suite |
| i18n | Routes 5 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |