MindeesUI
ComponentsOverlays

Command Palette

A Cmd or Ctrl-K style searchable command list in a centered modal, with case-insensitive filtering and optional grouping.

CommandPalette composes Modal with a search field and a filtered, optionally grouped command list. Filtering is a case-insensitive substring match on each command's label, and running a command closes the palette. Group order follows first-seen sequence, and the query resets each time the palette reopens.

Import

import { CommandPalette } from '@mindees/ui';

Usage

const [visible, setVisible] = useState(false);

return (
  <CommandPalette
    visible={visible}
    onClose={() => setVisible(false)}
    commands={[
      { id: 'new', label: 'New file', group: 'File', onRun: newFile },
      { id: 'open', label: 'Open…', group: 'File', onRun: openFile },
      { id: 'theme', label: 'Toggle theme', onRun: toggleTheme },
    ]}
  />
);

Props

PropTypeDefaultDescription
visiblebooleanControls whether the palette is shown.
onClose() => voidCalled on backdrop press, back, or after running.
commandsreadonly Command[]Commands (id, label, onRun, optional group).
placeholderstring'Type a command…'Search field placeholder.
emptyLabelstring'No commands found'Copy shown when the filter matches nothing.
accessibilityLabelstring'Command palette'Label announced when the palette opens.
styleStyleProp<ViewStyle>Style for the elevated panel (not the scrim).

Accessibility

Built on Modal, with the body marked accessibilityViewIsModal. The search field auto-focuses on open and is labeled by its placeholder. The list is rendered with accessibilityRole="menu" and each command row uses accessibilityRole="menuitem", meeting a 44pt minimum tap target.

On this page