ValyroUI Русская версия

Command Palette

⌘K-style command menu. Free, MIT · Navigation and layout › Menus and commands

Installation

npx valyro-cli@latest add command-palette
npx shadcn@latest add https://valyro.xyz/r/command-palette.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { CommandPalette } from 'valyro-ui';

Props

PropTypeDefault
commandsCommandPaletteItem[]Searchable commands, listed under their group headings and filtered by label and keywords. Or compose them as children: CommandPalette.Group and CommandPalette.Item.
childrenReactNodeThe compound form instead of commands: CommandPalette.Item elements, alone or in CommandPalette.Groups.
openbooleanControlled open state of the modal palette. Ignored when inline.
defaultOpenbooleanfalseInitial open state when uncontrolled. Ignored when inline.
onOpenChange(open: boolean) => voidCalled when the modal palette opens or closes.
inlinebooleanfalseRender the palette in the page flow instead of a modal: always open, no scrim or focus trap, Escape clears the query. For a command menu embedded in a page or a panel (a launcher, a search page).
placeholderstring'Type a command or search…'Placeholder of the search field.
renderEmpty(query: string) => ReactNode(query) => (query ? `No results for “${query}”` : 'No commands')Shown when nothing matches; receives the trimmed query.
labelsPartial<CommandPaletteLabels>Overrides for the built-in English strings.

Compound parts

CommandPalette.Item (CommandPaletteItemPart), CommandPalette.Group (CommandPaletteGroup)

Related components

Previous: Context Menu · Next: Keyboard Map Overlay · All Navigation and layout