Skip to components
DEVELOPER REFERENCE

CommandPalette API

Props, callbacks and methods. Select an underlined type to explore its fields, allowed values and callback arguments.

CommandPalette9 props2 callbacks0 methods

Preset and CSS

Set preset.className to attach your CSS class to the component's rendered surface. Explicit component props take precedence over preset options.

CSS parts in the example [data-part="root"]

Use styles.root and styles.parts in a theme and generate a CSS file with themeToCss. For other JSON-friendly component props, spread presetProps(preset) before explicit props. Parts and states depend on configuration; the gallery shows those visible in the current preview.

Props9

CommandPalette props
NameTypeDescription
openOptionalboolean | undefinedWhether the dialog is open.
labelRequiredstringLocalized dialog or inline palette title.
searchLabelRequiredstringLocalized search label and placeholder.
closeLabelOptionalstring | undefinedLocalized close action.
emptyLabelRequiredstringLocalized empty-results message.
commandsRequired
readonly PaletteCommand[]Inspect type
Commands in display order. Commands with the same group appear together.
inlineOptionalboolean | undefinedShow a persistent inline command list. Dialog props are ignored in this mode.
loopOptionalboolean | undefinedWrap arrow navigation at the beginning and end of the results.
presetOptional
ClassPreset | undefinedInspect type
Optional presentation preset.

Events and callbacks2

CommandPalette events and callbacks
NameTypeDescription
onCloseOptional
(() => void) | undefinedInspect type
Called when the dialog closes.
onExecuteRequired
(id: string) => voidInspect type
Called when an enabled command is activated.

Methods0

No component-specific imperative methods. Use props and callbacks to control this component.