Navigation
Project Search
A project-wide search where files, symbols, settings and documents share one list and are told apart by a type badge.
- command
- search
- results
- types
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-005?lang=en
Файл · 2
- registry.jsonregistry/components/navigation/
- command-001.tsxregistry/components/navigation/command-001/
Символ · 2
- validateSourcescripts/validate-meta.mjs:218
- pascalCasescripts/new-item.mjs:41
Настройка · 2
- Тема превьюКаталог → Превью
- Порог предупрежденийСборка → Проверки
Документ · 1
- Конвейер сборкиdocs/PIPELINE.md
Найдено 7 из 7
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-005" (Project Search) 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-005.json
Registry item: https://vibeui.ru/r/command-005.json
Installs to: components/vibeui/command-005.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 project-wide search where files, symbols, settings and documents share one list and are told apart by a type badge.
Project search with typed results: files, symbols, settings and documents grouped by type, each row carrying a badge and a path. Zero dependencies, one file.
## 3. How to use it
import { Command005 } from "@/components/vibeui/command-005"
<Command005 items={[{ label: "registry.json", kind: "Файл", detail: "registry/components/navigation/" }]} />
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-005-* palette — do not swap it for your theme tokens
- the type badge on every row: without it a file and a setting look identical
- grouping computed from the data rather than hand-written: a new type creates its own group
- the secondary path line — it is how identically named files are told apart
- searching both the label and the path: paths are often remembered better than names
- the role=combobox plus aria-activedescendant pairing: focus stays in the field
## 6. You may change
- the items array and the set of types
- the field hint through the placeholder prop
- the badge colours for new types
- the accent through the accent prop
## 7. Rules
- There is no ranking: results follow array order, add relevance sorting outside.
- Badge colours are defined for four types; a fifth needs its own rule or it falls back to the default.
- Enter does not navigate here: rows are picked by click, the handler is yours.
- 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-005.jsonhttps://vibeui.ru/r/command-005.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-command-005-*. Клиентский: "use client" ради поиска и клавиатуры. Фильтр идёт и по названию, и по второй строке (путь или контекст), а группировка по полю kind считается из данных — новый тип сам заводит новую группу. Каждая строка несёт квадратный значок с первой буквой типа и приглушённый моноширинный путь с многоточием. Роли listbox, group и option объявлены явно, стрелки ходят по плоскому видимому порядку.
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 Command005Result = {
label: string
kind: "Файл" | "Символ" | "Настройка" | "Документ"
detail: string
}
export type Command005Props = Omit<
ComponentPropsWithoutRef<"div">,
"children"
> & {
items?: Command005Result[]
placeholder?: string
accent?: string
}
// Идея компонента: поиск по всему проекту, где в одном списке лежат разные
// сущности. Без пометки типа файл и настройка выглядят одинаково, поэтому у
// каждой строки есть значок-квадрат с типом и приглушённая вторая строка с
// путём или контекстом. Группировка идёт по типу и считается из данных, а не
// задаётся руками: добавили новый тип — появилась новая группа.
const STYLES = `
:where([data-vibeui-block="command-005"]){
--vibeui-command-005-bg:oklch(1 0 0);
--vibeui-command-005-fg:oklch(0.23 0.014 265);
--vibeui-command-005-muted:oklch(0.57 0.014 265);
--vibeui-command-005-border:oklch(0.9 0.006 265);
--vibeui-command-005-accent:oklch(0.55 0.19 262);
--vibeui-command-005-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
--vibeui-command-005-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="command-005"]{
display:block;box-sizing:border-box;width:100%;max-width:25rem;overflow:hidden;
background:var(--vibeui-command-005-bg);color:var(--vibeui-command-005-fg);
border:1px solid var(--vibeui-command-005-border);border-radius:0.875rem;
box-shadow:0 18px 40px -28px oklch(0.2 0.03 265 / 60%);
font-family:var(--vibeui-command-005-font);
}
[data-vibeui-block="command-005"] 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-005-border);
background:none;color:inherit;font:inherit;font-size:0.9375rem;outline:none;
}
[data-vibeui-block="command-005"] input:focus{box-shadow:inset 0 -2px 0 0 var(--vibeui-command-005-accent)}
[data-vibeui-block="command-005"] [data-part="list"]{
list-style:none;margin:0;padding:0.3125rem;max-height:16rem;overflow-y:auto;
}
[data-vibeui-block="command-005"] [data-part="list"] [data-part="list"]{padding:0;max-height:none;overflow:visible}
[data-vibeui-block="command-005"] [data-part="group"]{
margin:0;padding:0.5rem 0.5625rem 0.25rem;
font-size:0.6875rem;font-weight:700;letter-spacing:0.05em;text-transform:uppercase;
color:var(--vibeui-command-005-muted);
}
[data-vibeui-block="command-005"] [data-part="row"]{
display:flex;align-items:center;gap:0.625rem;
padding:0.4375rem 0.5625rem;border-radius:0.5rem;cursor:pointer;
}
[data-vibeui-block="command-005"] [data-part="row"]:hover,
[data-vibeui-block="command-005"] [data-part="row"][aria-selected="true"]{
background:color-mix(in oklab,var(--vibeui-command-005-accent) 12%,transparent);
}
/* Значок типа — квадрат с буквой: он различает строки быстрее любой подписи. */
[data-vibeui-block="command-005"] [data-part="kind"]{
flex:none;display:grid;place-items:center;
width:1.375rem;height:1.375rem;border-radius:0.4375rem;
background:color-mix(in oklab,var(--vibeui-command-005-accent) 14%,transparent);
color:var(--vibeui-command-005-accent);
font-size:0.6875rem;font-weight:800;
}
[data-vibeui-block="command-005"] [data-part="row"][data-kind="Настройка"] [data-part="kind"]{background:oklch(0.62 0.16 55 / 18%);color:oklch(0.52 0.16 55)}
[data-vibeui-block="command-005"] [data-part="row"][data-kind="Символ"] [data-part="kind"]{background:oklch(0.55 0.2 300 / 16%);color:oklch(0.5 0.2 300)}
[data-vibeui-block="command-005"] [data-part="row"][data-kind="Документ"] [data-part="kind"]{background:oklch(0.56 0.15 165 / 18%);color:oklch(0.46 0.13 165)}
[data-vibeui-block="command-005"] [data-part="text"]{display:flex;flex-direction:column;min-width:0}
[data-vibeui-block="command-005"] [data-part="label"]{font-size:0.875rem;line-height:1.25}
[data-vibeui-block="command-005"] [data-part="detail"]{
font-family:var(--vibeui-command-005-mono);font-size:0.6875rem;
color:var(--vibeui-command-005-muted);
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
[data-vibeui-block="command-005"] [data-part="empty"]{
margin:0;padding:1.125rem 0.875rem;font-size:0.875rem;color:var(--vibeui-command-005-muted);
}
[data-vibeui-block="command-005"] [data-part="foot"]{
margin:0;padding:0.4375rem 0.875rem;border-top:1px solid var(--vibeui-command-005-border);
font-size:0.6875rem;color:var(--vibeui-command-005-muted);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="command-005"] *{animation:none!important;transition:none!important}}
`
const DEFAULT_RESULTS: Command005Result[] = [
{
label: "registry.json",
kind: "Файл",
detail: "registry/components/navigation/",
},
{
label: "command-001.tsx",
kind: "Файл",
detail: "registry/components/navigation/command-001/",
},
{
label: "validateSource",
kind: "Символ",
detail: "scripts/validate-meta.mjs:218",
},
{ label: "pascalCase", kind: "Символ", detail: "scripts/new-item.mjs:41" },
{ label: "Тема превью", kind: "Настройка", detail: "Каталог → Превью" },
{
label: "Порог предупреждений",
kind: "Настройка",
detail: "Сборка → Проверки",
},
{ label: "Конвейер сборки", kind: "Документ", detail: "docs/PIPELINE.md" },
]
/**
* Поиск по проекту: файлы, символы, настройки и документы в одном списке,
* группировка по типу. Один файл, ноль зависимостей.
*/
export function Command005({
items = DEFAULT_RESULTS,
placeholder = "Поиск по проекту…",
accent,
className,
style,
...props
}: Command005Props) {
const [query, setQuery] = useState("")
const [active, setActive] = useState(0)
const listId = useId()
const rowId = useId()
const needle = query.trim().toLowerCase()
const found = items.filter(
(result) =>
result.label.toLowerCase().includes(needle) ||
result.detail.toLowerCase().includes(needle),
)
const groups = found.reduce<Record<string, Command005Result[]>>(
(all, result) => {
all[result.kind] = all[result.kind]
? [...all[result.kind], result]
: [result]
return all
},
{},
)
const ordered = Object.values(groups).flat()
const current = ordered[Math.min(active, ordered.length - 1)]
const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
event.preventDefault()
if (ordered.length === 0) return
const step = event.key === "ArrowDown" ? 1 : -1
setActive((index) => (index + step + ordered.length) % ordered.length)
return
}
if (event.key === "Escape") {
event.preventDefault()
setQuery("")
setActive(0)
}
}
const paletteStyle = {
...(accent ? { "--vibeui-command-005-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-command-005" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="command-005"
className={className}
style={paletteStyle}
role="dialog"
aria-label="Поиск по проекту"
>
<input
type="text"
role="combobox"
aria-expanded={ordered.length > 0}
aria-controls={listId}
aria-autocomplete="list"
aria-activedescendant={
current ? `${rowId}-${ordered.indexOf(current)}` : undefined
}
aria-label={placeholder}
placeholder={placeholder}
value={query}
onChange={(event) => {
setQuery(event.target.value)
setActive(0)
}}
onKeyDown={onKeyDown}
/>
{ordered.length === 0 ? (
<p data-part="empty">По запросу ничего не найдено.</p>
) : (
<ul
id={listId}
data-part="list"
role="listbox"
aria-label="Результаты"
>
{Object.entries(groups).map(([kind, rows]) => (
<li key={kind} role="presentation">
<p data-part="group">
{kind} · {rows.length}
</p>
<ul data-part="list" role="group" aria-label={kind}>
{rows.map((result) => (
<li
key={`${result.kind}-${result.label}`}
id={`${rowId}-${ordered.indexOf(result)}`}
data-part="row"
data-kind={result.kind}
role="option"
aria-selected={current === result}
onClick={() => setActive(ordered.indexOf(result))}
>
<span data-part="kind" aria-hidden="true">
{result.kind.charAt(0)}
</span>
<span data-part="text">
<span data-part="label">{result.label}</span>
<span data-part="detail">{result.detail}</span>
</span>
</li>
))}
</ul>
</li>
))}
</ul>
)}
<p data-part="foot">
Найдено {ordered.length} из {items.length}
</p>
</div>
</>
)
}