Command Palette

Searchable command dialog with ranking, optional async source, and recent ids.

Also known as: command menu, spotlight, quick actions

Installation

Install with the CLI, or copy the component source into your project.

Add command-palette (npm)

npx --yes -p github:itsvigneshv/default-file-ui#main df-ui add command-palette

Properties

Searchable command dialog over kit Dialog. Ranks static commands, optional async results, and recent ids, then runs the active command.

CommandPalette

PropTypeDefaultNotes
openboolean-Controlled open state.
defaultOpenbooleanfalseUncontrolled initial open state.
onOpenChange(open: boolean) => void-Called when open changes. Closing clears the query and async session.
commandsCommandItem[]-Static command list (required).
source(query: string) => Promise<CommandItem[]>-Optional async source. Debounced while open; merged with static commands.
recentIdsstring[][]Command ids promoted when the query is empty.
onRun(command: CommandItem) => void-Called after a command is chosen, before command.run().
placeholderstring-Search field placeholder. Defaults to the string catalogue.
backgroundstring-Search field fill, forwarded to SearchInput.
emptyContentReactNode-Empty status content when nothing matches. Defaults to the string catalogue.
footerReactNode-Footer content under the list. Defaults to short keyboard hints.
classNamestring-Additional styles on DialogContent.

CommandItem

PropTypeDefaultNotes
idstring-Stable id (required).
labelstring-Visible and searchable label (required).
sectionstring-Group heading. Falls back to the catalogue commands label.
keywordsstring[]-Extra strings included in ranking.
rankTiernumber0Ranking band for query results. Lower tiers sort before higher tiers.
glyphReactNode-Leading mark on the option row.
shortcutstring-Optional shortcut shown with Kbd.
disabledboolean-Non-runnable option.
run() => void-Action invoked when the command runs (required).

Keyboard and accessibility

Dialog (aria-label): DialogContent receives the catalogue command-palette accessible name. Search (combobox): Search input is a combobox with aria-controls and aria-activedescendant pointing at the active option. List (listbox): Results render as a listbox of options. Arrow keys move the active option; Enter runs it; Escape closes.