+
+```gjs live preview no-shadow
+import { CommandPalette } from 'ember-primitives';
+import { on } from '@ember/modifier';
+import { tracked } from '@glimmer/tracking';
+
+class Demo {
+ @tracked searchQuery = '';
+
+ commands = [
+ { id: 1, name: 'Create new file', category: 'File' },
+ { id: 2, name: 'Open file', category: 'File' },
+ { id: 3, name: 'Save file', category: 'File' },
+ { id: 4, name: 'Search in files', category: 'Search' },
+ { id: 5, name: 'Find and replace', category: 'Search' },
+ { id: 6, name: 'Toggle sidebar', category: 'View' },
+ { id: 7, name: 'Toggle terminal', category: 'View' },
+ ];
+
+ get filteredCommands() {
+ if (!this.searchQuery) {
+ return this.commands;
+ }
+
+ const query = this.searchQuery.toLowerCase();
+ return this.commands.filter(cmd =>
+ cmd.name.toLowerCase().includes(query) ||
+ cmd.category.toLowerCase().includes(query)
+ );
+ }
+
+ handleInput = (event) => {
+ this.searchQuery = event.target.value;
+ };
+
+ selectCommand = (command) => {
+ console.log('Selected:', command.name);
+ };
+}
+
+const state = new Demo();
+
+
+
+
+
+
+
+
+
+
+ {{#if state.filteredCommands.length}}
+ {{#each state.filteredCommands as |command|}}
+
+ {{command.name}}
+ {{command.category}}
+
+ {{/each}}
+ {{else}}
+ No commands found
+ {{/if}}
+
+
+
+
+
+
+
+```
+
+
+
+## API
+
+### `