Components · Reference
Search Menu
A reusable command-palette search menu with grouped items, icons, descriptions, keyboard shortcut support, and a responsive search trigger.
Last updated September 28, 2026
Overview
SearchMenu is a reusable command-palette component built on shadcn's Command primitive. Pass it grouped items and it renders a responsive search trigger, ⌘K/Ctrl+K shortcut handling, searchable groups, optional item icons, descriptions, and shortcuts. Labels are stored in the component file and can be overridden with props or the messages prop.
Set the active locale once with KrakstackProvider; pass locale directly only when a component needs an override. Message overrides are keyed by arbitrary locale strings, so additional languages can be supplied with messages={{ es: { ... } }}. Exact locale keys such as es-MX take precedence over base keys such as es; English is the final fallback.
Install
bunx shadcn@latest add @krak-stack/search-menuFeatures
- Generic grouped item input
- Optional item icons, descriptions, keywords, disabled state, and shortcuts
- Per-item
onSelecthandlers plus a top-levelonSelectcallback - Controlled or uncontrolled open state
- Mobile icon-only trigger and desktop search-bar trigger
Usage
import { SearchMenu, type SearchMenuGroup } from "@/components/ui/search-menu";
import { FileText, Settings } from "lucide-react";
const groups: SearchMenuGroup[] = [
{
heading: "Pages",
items: [
{
id: "docs",
label: "Docs",
description: "Open documentation",
icon: <FileText className="size-4" />,
onSelect: () => navigate({ to: "/docs" }),
},
],
},
{
heading: "Settings",
items: [
{
id: "profile",
label: "Profile",
icon: <Settings className="size-4" />,
},
],
},
];
<SearchMenu
groups={groups}
locale={locale}
messages={{ [locale]: { title: "Search", description: "Search pages and actions." } }}
/>