Slash Command Menu

React slash command menu that filters commands by the typed query, shows each as /name with an optional hint, and falls back to a No commands message.

src/registry/ui/slash-command-menu.tsx/r/slash-command-menu.json

Installation#

bash
npx shadcn@latest add @minidev/slash-command-menu

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/slash-command-menu.json

Usage#

tsx
import { SlashCommandMenu } from "@/components/ui/slash-command-menu"

export function Example() {
  return (
    <SlashCommandMenu items={[{ id: "table", label: "table", hint: "Insert table" }, { id: "ai", label: "ai", hint: "Ask AI" }]} />
  )
}

API reference#

SlashCommandMenu props
PropTypeDefault
itemsItem[]SAMPLE_ITEMS
querystring""
onSelect(item: Item) => void-
classNamestring-

Examples#

All form components