← All Components
<mth-command-palette>
Modal command palette (Cmd/Ctrl+K) with keyword filtering, active-descendant listbox navigation, top-layer <dialog>, and global hotkey binding.
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-command-palette>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/command-palette"></script>
<mth-command-palette shortcut="mod+k" register-global-shortcut></mth-command-palette>import '@methane-ui/ui/command-palette';
import '@methane-ui/react';
export function Example() {
return <mth-command-palette shortcut="mod+k" register-global-shortcut></mth-command-palette>;
}<script setup lang="ts">
import '@methane-ui/ui/command-palette';
</script>
<template>
<mth-command-palette shortcut="mod+k" register-global-shortcut></mth-command-palette>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/command-palette';
import { MthCommandPaletteDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthCommandPaletteDirective],
template: `<mth-command-palette shortcut="mod+k" register-global-shortcut></mth-command-palette>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/command-palette';
import MthCommandPalette from '@methane-ui/svelte/MthCommandPalette.svelte';
</script>
<MthCommandPalette shortcut="mod+k" register-global-shortcut></MthCommandPalette>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
open | open | boolean | false | Controls whether the command palette dialog is visible. |
query | query | string | "" | Current search filter query string. |
label | label | string | "" | Accessible dialog label override. |
placeholder | placeholder | string | "" | Search input placeholder override. |
shortcut | shortcut | string | "mod+k" | Global hotkey combo used to toggle the command palette. |
registerGlobalShortcut | register-global-shortcut | boolean | true | Whether to bind the global hotkey listener on the document. |
forceFallback | force-fallback | boolean | false | Forces fallback modal overlay rendering instead of native <dialog>.showModal(). |
commands | — | ReadonlyArray<unknown> | [] | Command entries available for filtering and selection. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-open | void | Cancelable event dispatched before the command palette opens. |
mth-close | void | Cancelable event dispatched before the command palette closes. |
mth-query-change | { query: string } | Dispatched when the command search input value changes. |
mth-select | { id: string; label: string; href?: string } | Dispatched when a command option is chosen. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowDown | both | input focused | activates next matching command |
| ArrowUp | both | input focused | activates previous matching command |
| Enter | both | command active | executes active command and closes dialog |
| Escape | both | open | closes dialog and restores trigger focus |
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-command-palette.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(open), :state(empty). | Conformance suite |
| i18n | Routes 6 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |