EXEPERTAI LAB

Research alpha

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

Command Palette Input

Search input slot. Auto-focuses on mount. Wires to command palette context when used inside CommandPalette.

Open in Playground @astryxdesign/core/CommandPalette

Showcases and examples

2 documented examples

Command Palette Input

Command palette search input with a custom placeholder and a keyboard shortcut hint in the endContent slot.

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

'use client';

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

export default function CommandPaletteInputShowcase() {
  const source = useMemo(
    () =>
      createStaticSource([
        {id: 'home', label: 'Home'},
        {id: 'settings', label: 'Settings'},
        {id: 'profile', label: 'Profile'},
        {id: 'help', label: 'Help'},
      ]),
    [],
  );

  return (
    <CommandPalette
      isOpen
      isInline
      onOpenChange={() => {}}
      searchSource={source}
      input={
        <CommandPaletteInput
          placeholder="Search commands, files, or actions..."
          endContent={<Kbd keys="mod+k" />}
        />
      }
    />
  );
}

Usage

Search input slot. Auto-focuses on mount. Wires to command palette context when used inside CommandPalette.

Typed props

PropType and behavior
placeholderstring · default 'Search...'
Placeholder text for the input.
labelstring
Accessible label for the combobox input, announced by screen readers. Falls back to the placeholder text when omitted.
hasAutoFocusboolean · default true
Auto-focus the input when mounted. Automatically disabled when inside an inline command palette.
endContentReactNode
Content rendered at the trailing end of the input, after the spinner. Use for clear buttons or keyboard shortcut hints.
Slot: Icon, Badge
valuestring
Search value. When omitted inside CommandPalette, reads from context.
onValueChange(value: string) => void
Called when search value changes. When omitted inside CommandPalette, writes to context.
xstyleStyleXStyles
StyleX styles for layout customization. Must be a stylex.create() value.