All components

Command

Find an action in a palette.

Examples

Find an action in a palette

React code
import {
  Command,
  Label,
  ComboboxInput,
  ComboboxOptions,
  ComboboxOption,
} from "@accelerate/react/components";

export function Example() {
  return (
    <>
      <Command>
        <Label htmlFor="action-search">Find an action</Label>
        <ComboboxInput id="action-search" />
        <ComboboxOptions id="action-results" aria-label="Actions">
          <ComboboxOption value="open">Open queue</ComboboxOption>
          <ComboboxOption value="review">Review changes</ComboboxOption>
        </ComboboxOptions>
      </Command>
    </>
  );
}
Angular code
import { Component } from "@angular/core";
import {
  AccCommand,
  AccLabel,
  AccComboboxInput,
  AccComboboxOptions,
  AccComboboxOption,
} from "@accelerate/angular/components";

@Component({
  selector: "app-example",
  imports: [
    AccCommand,
    AccLabel,
    AccComboboxInput,
    AccComboboxOptions,
    AccComboboxOption,
  ],
  template: `
    <div accCommand>
      <label accLabel for="action-search">Find an action</label>
      <input accComboboxInput id="action-search">
      <div accComboboxOptions id="action-results" aria-label="Actions">
        <button accComboboxOption value="open">Open queue</button>
        <button accComboboxOption value="review">Review changes</button>
      </div>
    </div>
  `,
})
export class Example {}

Installation

Source preview. The expanded component catalog is ahead of the public npm releases. To run these examples in your own application, use packages built from the SDK source used for the previews or a release that includes the APIs below.

React
@accelerate/ui@0.4.0 and @accelerate/react@0.4.0
Angular
@accelerate/ui@0.4.0 and @accelerate/angular@0.2.0

Load @accelerate/ui/theme.css and put acc-theme on the app or the region using Accelerator components. See the framework setup guide for the theme and adapter conventions.

Usage

Uses the combobox parts for a searchable action list. Use it inside Dialog for a command palette.

Import the React component Command from @accelerate/react/components. For Angular, add AccCommand to the standalone component’s imports and use <div accCommand>.

Examples use these React parts: Command, Label, ComboboxInput, ComboboxOptions, ComboboxOption. The Angular examples show the corresponding directives and template hosts.

API reference

ComboboxOptions id
Required for the searchable results list.
valueChange
Bind the selected action to application logic. Wrap the palette in Dialog for a modal.