A Spotlight / Cmd+K overlay for quickly navigating and executing actions. Supports grouped results, keyboard navigation (↑↓ + Enter), substring filtering across labels, descriptions, and groups, and shortcut hints. Walkthrough: Building a Linear-style command palette in Angular 22.
Unlock it plus 90 pro blocks, widgets & layouts — $99 one-time. Lifetime updates, 14-day money-back guarantee.
Bind [(open)] to toggle the palette. Pass a flat or grouped array of CommandItem objects. Listen to (selected) for the chosen command.
<button (click)="isOpen = true">Open</button> <base-command-palette [(open)]="isOpen" [items]="commands" (selected)="onCommand($event)"> </base-command-palette>
commands: CommandItem[] = [
{ id: 'home', label: 'Go to Home', group: 'Navigation', icon: 'home', shortcut: '⌘H' },
{ id: 'theme', label: 'Toggle Dark Mode', group: 'Settings', icon: 'moon' },
];
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add command-palette
// Paths are relative to aliases.components (default: src/app/components)
import { CommandPaletteComponent } from './command-palette/command-palette.component';
@Component({
selector: 'app-command-palette-example',
imports: [
CommandPaletteComponent
],
template: `...`
})
export class CommandPaletteExampleComponent {}Install
npx base-ui-cli add command-palette
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add command-palette
// Paths are relative to aliases.components (default: src/app/components)
import { CommandPaletteComponent } from './command-palette/command-palette.component';
@Component({
selector: 'app-command-palette-example',
imports: [
CommandPaletteComponent
],
template: `...`
})
export class CommandPaletteExampleComponent {}Install
npx base-ui-cli add command-palette
interface CommandItem {
id: string; // Unique identifier
label: string; // Display name
group?: string; // Optional section heading
icon?: string; // Icon pack name
shortcut?: string; // Keyboard hint e.g. '⌘K'
description?: string // Subtitle text
}
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add command-palette
// Paths are relative to aliases.components (default: src/app/components)
import { CommandPaletteComponent } from './command-palette/command-palette.component';
@Component({
selector: 'app-command-palette-example',
imports: [
CommandPaletteComponent
],
template: `...`
})
export class CommandPaletteExampleComponent {}Install
npx base-ui-cli add command-palette
Run the following command to add this component to your project:
npx base-ui-cli add command-palette
For AI agents
Copy a prompt with the registry name, CLI install, and import — or add the Base UI MCP server.
npx -y base-ui-ng-mcp
Base UI provides standalone components. Import the exact elements you want to use into your component.
// Install: npx base-ui-cli add command-palette
// Paths are relative to aliases.components (default: src/app/components)
import { CommandPaletteComponent } from './command-palette/command-palette.component';
@Component({
selector: 'app-your-component',
imports: [
CommandPaletteComponent
],
template: `...`
})
export class YourComponent {} API for command-palette — generated from JSDoc in the library source.
| API | Member | Type | Default | Description |
|---|---|---|---|---|
base-command-palette | open | boolean | false | — |
base-command-palette | items | CommandItem[] | [] | — |
base-command-palette | placeholder | unknown | 'Type a command or search…' | — |
base-command-palette | (openChange) | boolean | — | Emits when openChange occurs. |
base-command-palette | (selected) | CommandItem | — | Emits when selected occurs. |
Content