Grok Slash Menu
brainless/grok-slash-menuFreeComponent
Slash-command overlay above the real GrokPrompt composer — ❯ active row, type after / to filter.
Install it
npx shadcn@latest add https://brainless.swerdlow.dev/r/grok-slash-menu.jsonSource
1"use client";23import * as React from "react";4import { GrokPrompt } from "@/registry/brainless/grok/grok-prompt";5import { cn } from "@/lib/utils";67/**8 * GrokSlashMenu — Grok CLI's slash-command palette.9 *10 * Overlay above the rounded composer: active row marked with `❯`, inactive11 * rows indented. Type after `/` to filter; arrow keys move selection.12 */13export type GrokSlashCommand = { name: string; description: string };1415const DEFAULT: GrokSlashCommand[] = [16 { name: "/quit", description: "Quit the application" },17 { name: "/help", description: "Browse commands and keyboard shortcuts" },18 { name: "/docs", description: "Open How-to Guides or online Build docs" },19 { name: "/home", description: "Return to the welcome screen" },20 { name: "/new", description: "Start a new session" },21 { name: "/fork", description: "Branch the current session into a peer agent" },22];2324const ACTIVE = "#e1e1e1";25const INACTIVE = "#8b8b90";26const RULE = "#505058";27const NAME_COLS = 16;2829export function GrokSlashMenu({30 commands = DEFAULT,31 className,32}: {33 commands?: GrokSlashCommand[];34 className?: string;35}) {36 const [value, setValue] = React.useState("/");37 const [active, setActive] = React.useState(0);3839 const query = value.startsWith("/") ? value.slice(1) : value;40 const list = commands.filter((c) =>41 c.name.slice(1).toLowerCase().startsWith(query.toLowerCase()),42 );43 const clampedActive = list.length ? Math.min(active, list.length - 1) : 0;4445 function onKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {46 if (!list.length) return;47 if (e.key === "ArrowDown") {48 e.preventDefault();49 setActive((a) => (a + 1) % list.length);50 } else if (e.key === "ArrowUp") {51 e.preventDefault();52 setActive((a) => (a - 1 + list.length) % list.length);53 }54 }5556 return (57 <div className={cn("font-mono text-[13px] leading-[1.55]", className)}>58 <div59 className="mb-2 border-y py-1.5"60 style={{ borderColor: RULE }}61 role="listbox"62 aria-label="Slash commands"63 aria-activedescendant={64 list.length ? `grok-slash-${clampedActive}` : undefined65 }66 >67 <ul className="space-y-0.5">68 {list.map((c, i) => {69 const activeRow = i === clampedActive;70 return (71 <li72 key={c.name}73 id={`grok-slash-${i}`}74 role="option"75 aria-selected={activeRow}76// … truncated
What it pulls in
Other registry items
Files it writes
More from brainless
All 40 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Claude Diffclaude-diff | brainless | Components | Free | no deps | |
| Claude Headerclaude-header | brainless | Components | Free | no deps | |
| Claude Messageclaude-message | brainless | Components | Free | no deps | |
| Claude Permissionclaude-permission | brainless | Components | Free | no deps | |
| Claude Promptclaude-prompt | brainless | Components | Free | no deps | |
| Claude Slash Menuclaude-slash-menu | brainless | Components | Free | no deps | |
| Claude Thinkingclaude-thinking | brainless | Components | Free | no deps | |
| Claude Todo Listclaude-todo-list | brainless | Components | Free | no deps |
