Command Palette
Меню команд в стиле ⌘K. Бесплатно, MIT · Навигация и каркас › Меню и команды
Установка
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';
Пропсы
| Prop | Type | Default | |
|---|---|---|---|
commands | CommandPaletteItem[] | Searchable commands, listed under their group headings and filtered by label and keywords. Or compose them as children: CommandPalette.Group and CommandPalette.Item. | |
children | ReactNode | The compound form instead of commands: CommandPalette.Item elements, alone or in CommandPalette.Groups. | |
open | boolean | Controlled open state of the modal palette. Ignored when inline. | |
defaultOpen | boolean | false | Initial open state when uncontrolled. Ignored when inline. |
onOpenChange | (open: boolean) => void | Called when the modal palette opens or closes. | |
inline | boolean | false | Render 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). |
placeholder | string | '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. |
labels | Partial<CommandPaletteLabels> | Overrides for the built-in English strings. |
Составные части
CommandPalette.Item (CommandPaletteItemPart), CommandPalette.Group (CommandPaletteGroup)
Похожие компоненты
- Dropdown Menu — Выпадающее меню
- Context Menu — Контекстное меню
- Keyboard Map Overlay — Карта горячих клавиш экрана: поиск, клавиатура и режим тренировки
- App Shell — Каркас приложения
- Navbar — Верхняя навигация
- Sidebar — Боковая панель
- Resizable Panels — Панели с изменяемым размером
- Breadcrumbs — Хлебные крошки
- Tabs — Вкладки
- Segmented Control — Переключатель режимов
- Pagination — Постраничная навигация
- Stepper — Пошаговые процессы
Назад: Context Menu · Далее: Keyboard Map Overlay · Весь раздел «Навигация и каркас»