Slash Command Palette
A "/"-triggered command palette over a local tool/command list — name, category, description, and icon — to layer onto a PromptInput Tools slot.
Slash Command Palette
The Slash Command Palette is a command-palette dropdown triggered by "/" in the composer to pick tools or commands by name, category, description, and icon — designed to layer onto a PromptInput Tools slot. It is purely presentational over a local list: the consumer decides when to open it (e.g. when the composer value starts with "/") and what query to pass.
It is built on the shadcn/ui Command (cmdk) primitive for fuzzy filtering and keyboard navigation, so it inherits your theme.
When to use it: a composer where typing "/" should reveal a pickable list of tools or commands.
Preview
Installation
pnpm dlx shadcn@latest add @localmode/ui/input-controls/slash-command-palettenpx shadcn@latest add @localmode/ui/input-controls/slash-command-paletteyarn dlx shadcn@latest add @localmode/ui/input-controls/slash-command-palettebunx --bun shadcn@latest add @localmode/ui/input-controls/slash-command-paletteDependencies
- Data source: renders the
commandslist you pass and emitsonSelect/onDismisscallbacks — works with any backend. Recommended LocalMode producer: a local tool/command list (e.g. an agent's tool registry) (optional). cmdk— the underlying command primitivelucide-react— iconsclsx+tailwind-merge— via the sharedcn()util (installed automatically)
Files installed
slash-command-palette.tsx— the componentui/command.tsx— the shadcn/ui command primitive (registry dependency)lib/utils.ts— thecn()helper (if not already present)
Props
SlashCommandPalette
Prop
Type
Examples
Open when the composer starts with "/"
import { useState } from 'react';
import { Search, Image } from 'lucide-react';
import { SlashCommandPalette } from '@/components/slash-command-palette';
const COMMANDS = [
{ id: 'search', name: 'search', description: 'Search the web', category: 'Tools', icon: Search },
{ id: 'image', name: 'image', description: 'Generate an image', category: 'Tools', icon: Image },
];
export function Composer() {
const [value, setValue] = useState('');
const open = value.startsWith('/');
return (
<div className="relative">
<input value={value} onChange={(e) => setValue(e.target.value)} />
{open && (
<SlashCommandPalette
commands={COMMANDS}
open={open}
query={value.slice(1)}
onSelect={(cmd) => setValue(`/${cmd.name} `)}
onDismiss={() => setValue('')}
/>
)}
</div>
);
}Customization
Commands are grouped by category (uncategorized commands fall under "Commands"). The palette filters on name + description via cmdk. Position it yourself (e.g. absolutely below the composer). Everything is theme-driven via shadcn/ui CSS variables — edit the copied file to change the row layout or add command shortcuts.
Parameter Slider
An inline range slider with a live value readout for tuning local generation parameters — temperature, top-k, top-p, max tokens, GPU layers, KV-cache.
Option List
An inline multi-choice selection list (5–7 options then paginate) for human-in-the-loop agent inquiries — distinct from quick-reply suggestion chips.