Navigation
Shortcut Cheatsheet
A shortcut cheatsheet palette: each combination is stored as an array of keys, and search matches both the label and the keys themselves.
- command
- shortcuts
- kbd
- palette
Preview
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this in the header: https://vibeui.ru/c/command-006?lang=en
- Открыть палитру⌘K
- Сохранить файл⌘S
- Перейти к каталогуGC
- Перейти к блокамGB
- Переключить панель⌘B
- Отменить действие⌘Z
- Пересобрать реестр⌘⇧R
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
# Install and place "command-006" (Shortcut Cheatsheet) from VibeUI
## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/command-006.json
Registry item: https://vibeui.ru/r/command-006.json
Installs to: components/vibeui/command-006.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.
Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.
## 2. What it is
A shortcut cheatsheet palette: each combination is stored as an array of keys, and search matches both the label and the keys themselves.
A palette with a shortcut on every row: keys in separate kbd elements, search across names and combinations, arrow highlighting. Zero dependencies, one file.
## 3. How to use it
import { Command006 } from "@/components/vibeui/command-006"
<Command006 commands={[{ label: "Open palette", keys: ["⌘", "K"] }]} />
Read the installed file for the full prop list.
## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.
Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)
## 5. Keep exactly as installed
- the local --vibeui-command-006-* palette — do not swap it for your theme tokens
- the key array instead of a string: only that makes a sequence read as two presses
- a separate <kbd> per key — that is semantics, not decoration
- searching keys alongside labels: the combination is remembered more often than the name
- the aria-label on the key group: otherwise a screen reader reads a pile of symbols
- the stronger kbd border on the highlighted row — the highlight must not vanish over the keys
## 6. You may change
- the commands array and the combinations themselves
- the field hint through the placeholder prop
- the kbd styling to match your typography
- the accent through the accent prop
## 7. Rules
- The component does not bind the shortcuts: this is a reference, the key handlers stay yours.
- Modifier glyphs render as given — substitute Ctrl and Alt for Windows from outside.
- Enter on a row runs nothing: add a handler for your own command model.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.
## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.For developers
npx shadcn@latest add https://vibeui.ru/r/command-006.jsonhttps://vibeui.ru/r/command-006.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-command-006-*. Клиентский: "use client" ради поиска и стрелок. Сочетание описано массивом keys, а не строкой, поэтому каждая клавиша получает собственный <kbd> и последовательности вроде «G затем C» читаются как два нажатия. Фильтр проверяет и label, и склеенные клавиши: «⌘K» находит команду быстрее, чем попытка вспомнить её имя. Группе клавиш выдан aria-label, иначе строка озвучивается набором отдельных символов.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
"use client"
import { useId, useState } from "react"
import type {
ComponentPropsWithoutRef,
CSSProperties,
KeyboardEvent,
} from "react"
export type Command006Command = {
label: string
keys: string[]
}
export type Command006Props = Omit<
ComponentPropsWithoutRef<"div">,
"children"
> & {
commands?: Command006Command[]
placeholder?: string
accent?: string
}
// Идея компонента: палитра как шпаргалка по горячим клавишам. Сочетание
// хранится массивом клавиш, а не строкой, поэтому каждая клавиша получает свой
// <kbd> и последовательности вроде «G затем C» читаются как два нажатия, а не
// как одно. Поиск идёт и по названию, и по самим клавишам: «⌘K» находит
// команду быстрее, чем попытка вспомнить её имя.
const STYLES = `
:where([data-vibeui-block="command-006"]){
--vibeui-command-006-bg:oklch(1 0 0);
--vibeui-command-006-fg:oklch(0.23 0.014 265);
--vibeui-command-006-muted:oklch(0.57 0.014 265);
--vibeui-command-006-border:oklch(0.9 0.006 265);
--vibeui-command-006-accent:oklch(0.56 0.15 165);
--vibeui-command-006-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="command-006"]{
display:block;box-sizing:border-box;width:100%;max-width:24rem;overflow:hidden;
background:var(--vibeui-command-006-bg);color:var(--vibeui-command-006-fg);
border:1px solid var(--vibeui-command-006-border);border-radius:0.875rem;
box-shadow:0 18px 40px -28px oklch(0.2 0.03 265 / 60%);
font-family:var(--vibeui-command-006-font);
}
[data-vibeui-block="command-006"] input{
box-sizing:border-box;width:100%;height:2.875rem;padding:0 0.875rem;
appearance:none;border:0;border-bottom:1px solid var(--vibeui-command-006-border);
background:none;color:inherit;font:inherit;font-size:0.9375rem;outline:none;
}
[data-vibeui-block="command-006"] input:focus{box-shadow:inset 0 -2px 0 0 var(--vibeui-command-006-accent)}
[data-vibeui-block="command-006"] [data-part="list"]{
list-style:none;margin:0;padding:0.3125rem;max-height:15rem;overflow-y:auto;
}
[data-vibeui-block="command-006"] [data-part="row"]{
display:flex;align-items:center;gap:0.75rem;
padding:0.4375rem 0.5625rem;border-radius:0.5rem;cursor:pointer;font-size:0.875rem;
}
[data-vibeui-block="command-006"] [data-part="row"]:hover,
[data-vibeui-block="command-006"] [data-part="row"][aria-selected="true"]{
background:color-mix(in oklab,var(--vibeui-command-006-accent) 14%,transparent);
}
/* Сочетание — массив клавиш: «G затем C» читается как два нажатия. */
[data-vibeui-block="command-006"] [data-part="keys"]{
display:inline-flex;align-items:center;gap:0.25rem;margin-left:auto;flex:none;
}
[data-vibeui-block="command-006"] kbd{
min-width:1.25rem;padding:0 0.3125rem;text-align:center;
border:1px solid var(--vibeui-command-006-border);border-bottom-width:2px;border-radius:0.3125rem;
background:oklch(0.98 0.002 265);
font:inherit;font-size:0.6875rem;font-weight:650;line-height:1.25rem;
color:var(--vibeui-command-006-muted);
}
[data-vibeui-block="command-006"] [data-part="row"][aria-selected="true"] kbd{
border-color:color-mix(in oklab,var(--vibeui-command-006-accent) 40%,var(--vibeui-command-006-border));
color:var(--vibeui-command-006-fg);
}
[data-vibeui-block="command-006"] [data-part="empty"]{
margin:0;padding:1.125rem 0.875rem;font-size:0.875rem;color:var(--vibeui-command-006-muted);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="command-006"] *{animation:none!important;transition:none!important}}
`
const DEFAULT_COMMANDS: Command006Command[] = [
{ label: "Открыть палитру", keys: ["⌘", "K"] },
{ label: "Сохранить файл", keys: ["⌘", "S"] },
{ label: "Перейти к каталогу", keys: ["G", "C"] },
{ label: "Перейти к блокам", keys: ["G", "B"] },
{ label: "Переключить панель", keys: ["⌘", "B"] },
{ label: "Отменить действие", keys: ["⌘", "Z"] },
{ label: "Пересобрать реестр", keys: ["⌘", "⇧", "R"] },
]
/**
* Палитра с горячими клавишами у каждой строки: поиск идёт и по названию,
* и по клавишам. Один файл, ноль зависимостей.
*/
export function Command006({
commands = DEFAULT_COMMANDS,
placeholder = "Команда или сочетание…",
accent,
className,
style,
...props
}: Command006Props) {
const [query, setQuery] = useState("")
const [active, setActive] = useState(0)
const listId = useId()
const rowId = useId()
const needle = query.trim().toLowerCase()
const rows = commands.filter(
(command) =>
command.label.toLowerCase().includes(needle) ||
command.keys.join("").toLowerCase().includes(needle),
)
const current = rows[Math.min(active, rows.length - 1)]
const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
event.preventDefault()
if (rows.length === 0) return
const step = event.key === "ArrowDown" ? 1 : -1
setActive((index) => (index + step + rows.length) % rows.length)
return
}
if (event.key === "Escape") {
event.preventDefault()
setQuery("")
setActive(0)
}
}
const paletteStyle = {
...(accent ? { "--vibeui-command-006-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-command-006" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="command-006"
className={className}
style={paletteStyle}
role="dialog"
aria-label="Горячие клавиши"
>
<input
type="text"
role="combobox"
aria-expanded={rows.length > 0}
aria-controls={listId}
aria-autocomplete="list"
aria-activedescendant={
current ? `${rowId}-${rows.indexOf(current)}` : undefined
}
aria-label={placeholder}
placeholder={placeholder}
value={query}
onChange={(event) => {
setQuery(event.target.value)
setActive(0)
}}
onKeyDown={onKeyDown}
/>
{rows.length === 0 ? (
<p data-part="empty">Такого сочетания нет — попробуйте другое.</p>
) : (
<ul id={listId} data-part="list" role="listbox" aria-label="Команды">
{rows.map((command, index) => (
<li
key={command.label}
id={`${rowId}-${index}`}
data-part="row"
role="option"
aria-selected={current === command}
onClick={() => setActive(index)}
>
{command.label}
<span
data-part="keys"
aria-label={`Сочетание: ${command.keys.join(" ")}`}
>
{command.keys.map((key, position) => (
<kbd key={`${key}-${position}`}>{key}</kbd>
))}
</span>
</li>
))}
</ul>
)}
</div>
</>
)
}