event.stopPropagation()}
>
{
setQuery(event.target.value);
setActiveIndex(0);
}}
onKeyDown={(event) => {
if (event.key === "ArrowDown") {
event.preventDefault();
setActiveIndex((index) =>
Math.min(index + 1, Math.max(0, flat.length - 1)),
);
} else if (event.key === "ArrowUp") {
event.preventDefault();
setActiveIndex((index) => Math.max(index - 1, 0));
} else if (event.key === "Enter") {
event.preventDefault();
runRow(flat[safeIndex]);
} else if (event.key === "Escape") {
onClose();
}
}}
placeholder="Search tags or run a command…"
className="w-full bg-transparent py-3 font-mono text-sm text-ctp-text placeholder:text-ctp-overlay0 focus:outline-none"
/>
{tagsQuery.isFetching ? (
) : null}
{flat.length === 0 ? (
{needle ? "No matching commands or tags" : "Type to search"}
) : (
sections.map((section) => (
{section.title}
{section.rows.map((row) => {
const index = flat.indexOf(row);
const active = index === safeIndex;
return (
setActiveIndex(index)}
onClick={() => runRow(row)}
className={cn(
"flex w-full cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition",
active
? "bg-ctp-surface1 text-ctp-text"
: "text-ctp-subtext0",
)}
>
{rowContent(row)}
);
})}
))
)}
Enter searches the
highlighted tag — the + button only follows/unfollows
↑↓ · Esc