EXEPERTAI LAB

Research alpha

Time Machine
EXEPERTAI LAB
GALLERY / COLLECTION
← Browse Astryx gallery
CommandPalette·component·@astryxdesign/core

Command Palette

Root component. Manages open state, search, keyboard navigation, and composition slots.

Open in Playground @astryxdesign/core/CommandPalette

Showcases and examples

6 documented examples

Command Palette

Basic command palette with static items and keyboard navigation.

Preview loads on approachPreview loads on approach
Exact source · command-palette-showcase
// Copyright (c) Meta Platforms, Inc. and affiliates.

'use client';

import {useMemo} from 'react';
import {CommandPalette} from '@astryxdesign/core/CommandPalette';
import {createStaticSource} from '@astryxdesign/core/Typeahead';

// Remove isInline for production — command palettes should be modal.
export default function CommandPaletteShowcase() {
  const source = useMemo(
    () =>
      createStaticSource([
        {id: 'home', label: 'Home'},
        {id: 'settings', label: 'Settings'},
        {id: 'profile', label: 'Profile'},
        {id: 'dashboard', label: 'Dashboard'},
        {id: 'help', label: 'Help'},
      ]),
    [],
  );

  return (
    <CommandPalette
      isOpen
      isInline
      onOpenChange={() => {}}
      searchSource={source}
    />
  );
}

Usage

CommandPalette is a searchable dialog for quick access to commands, navigation, and actions. Use it as a keyboard-driven launcher powered by SearchSource for filtering and selection.

  • Provide a searchSource with bootstrap results so users see useful options before typing.
  • Use auxiliaryData.group on items to automatically organize results into labeled sections.
  • Use CommandPalette for simple dropdowns or menus; use Menu or Selector for inline selections.
  • Add too many groups or items; curate results to keep the palette fast and scannable.

Typed props

PropType and behavior
isOpenboolean · required
Whether the command palette dialog is visible.
onOpenChange(isOpen: boolean) => void · required
Called when the palette visibility changes.
searchSourceSearchSource<T> · required
Search source providing items via search(query) and bootstrap(). Use createStaticSource for static lists.
inputReactNode · default <CommandPaletteInput />
Input slot. Defaults to CommandPaletteInput with standard behavior.
Slot: TextInput
footerReactNode · default <CommandPaletteFooter />
Footer slot. Defaults to CommandPaletteFooter showing keyboard hints.
Slot: Text
renderItem(item: T, isSelected: boolean) => ReactNode
Per-item render function. Auto-grouping by auxiliaryData.group is preserved. When omitted, renders label text.
emptySearchTextReactNode · default 'No results'
Content shown when a search query returns no results.
emptyBootstrapTextReactNode · default 'Type to search'
Content shown when there is no search query and bootstrap() returns nothing.
valuestring
Controlled selected value for picker mode.
onValueChange(value: string) => void
Called when the selected value changes in picker mode.
labelstring · default 'Command palette'
Accessible label for the command palette dialog.
widthnumber | string · default 640
Width of the dialog.
maxHeightnumber | string · default 480
Maximum height of the dialog.
isInlineboolean · default false
Renders command palette content inline without modal behavior. Automatically disables input auto-focus and initial highlighted-item auto-scroll. For documentation previews and showcases only.

Anatomy

Dialog · required

Modal surface that contains the command palette.

Input · required

Search region containing the query field and its supporting visuals.

Search glyph · required

Search symbol rendered by Icon in the default Input.

Query field · required

Native text field used to enter a search query.

Loading spinner · optional

Spinner shown in the default Input while a search is pending.

List · required

Scrollable listbox containing the current results or Empty state.

Item · optional

Selectable command result rendered inside the List.

Group · optional

Optional collection of Items that share a heading.

Group heading · optional

Visible heading rendered for a Group.

Empty · optional

Message shown when the current result set is empty.

Footer · optional

Footer region for default keyboard guidance or caller-provided content.

Keyboard shortcut · optional

Painted key badges rendered by Kbd in the default Footer guidance.

Theming

Targets

astryx-command-palette-empty
astryx-command-palette-footer
astryx-command-palette-group
astryx-command-palette-group-heading
astryx-command-palette-input
astryx-command-palette-item
astryx-command-palette-list