← All Components
<mth-site-search>
Async site search combobox backed by DataController, ListboxController, positioned [popover] results overlay, and optional keyboard focus shortcut.
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-site-search>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/site-search"></script>
<mth-site-search shortcut="/"></mth-site-search>import '@methane-ui/ui/site-search';
import '@methane-ui/react';
export function Example() {
return <mth-site-search shortcut="/"></mth-site-search>;
}<script setup lang="ts">
import '@methane-ui/ui/site-search';
</script>
<template>
<mth-site-search shortcut="/"></mth-site-search>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/site-search';
import { MthSiteSearchDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthSiteSearchDirective],
template: `<mth-site-search shortcut="/"></mth-site-search>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/site-search';
import MthSiteSearch from '@methane-ui/svelte/MthSiteSearch.svelte';
</script>
<MthSiteSearch shortcut="/"></MthSiteSearch>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
open | open | boolean | false | Controls visibility of the search results popup. |
query | query | string | "" | Current search query string. |
label | label | string | "" | Accessible label override for the search input. |
placeholder | placeholder | string | "" | Placeholder override for the search input. |
shortcut | shortcut | string | "/" | Global hotkey that focuses the search input when not inside an editable control. |
registerShortcut | register-shortcut | boolean | false | Enables the document focus shortcut listener. |
forceFallback | force-fallback | boolean | false | Forces JS fallback overlay/positioning instead of native [popover]. |
items | — | ReadonlyArray<unknown> | [] | Local fallback items searched when no external dataSource is provided. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-open | void | Cancelable event dispatched before the search results popup opens. |
mth-close | void | Cancelable event dispatched before the search results popup closes. |
mth-query-change | { query: string } | Dispatched when the user edits the search query. |
mth-select | { id: string; label: string; href?: string } | Dispatched when a search result option is selected. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowDown | both | input focused | opens results and activates next result |
| ArrowUp | both | input focused | activates previous result |
| Enter | both | result active | emits mth-select and closes popup |
| Escape | both | popup open | closes popup |
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 4 APG keyboard transitions across LTR/RTL. | mth-site-search.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(open), :state(loading), :state(empty), :state(error). | Conformance suite |
| i18n | Routes 7 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |