Skip to Content
Kokonut UI

NV-05Navigation

Command Palette

⌘K command palette with nested pages, fuzzy matching and in-row progress for running actions.

Install with
lucide-react, motion

PROSearching your docs? Docs Search is in Kokonut UI Pro

Installation

Command Palette is a free, open-source React component in the Kokonut UI Navigation collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/action-search-bar.tsx, so the code is yours to change.

npx shadcn@latest add @kokonutui/action-search-bar

Or add it by hand: install its packages, then copy the source from Copy code above into components/kokonutui/action-search-bar.tsx.

npm install lucide-react motion

Usage

import ActionSearchBar from "@/components/kokonutui/action-search-bar";

export default function Example() {
  return <ActionSearchBar />;
}

Props

items
CommandItem[]Default sampleItems
defaultRecent
string[]Default ["copy-link", "theme-dark"]

Ids shown under "Recent" before anything is typed. Running a row adds it.

onSelect
(item: CommandItem, path: CommandItem[]) => unknown

Called when a row without children is chosen. Return a Promise to show a spinner in the row until it settles; a rejection leaves the palette open.

onOpenChange
(open: boolean) => void
defaultOpen
booleanDefault false
shortcut
booleanDefault false

⌘K / Ctrl+K toggles the palette. By default it only does so while the palette is focused or hovered, so the host page keeps its own ⌘K. Set true to take ⌘K page-wide whenever the palette is on screen.

label
stringDefault "Search commands"
placeholder
stringDefault "Search or jump to…"
className
string

Extra classes for the root element.

CommandItem

idrequired
string
labelrequired
string
icon
ReactNode
group
string

Section heading on its page, such as "Actions" or "Links".

keywords
string[]

Extra words the row matches on, without being shown.

shortcut
string[]

Keys shown at the end of the row, such as ["⌘", "N"].

href
string

Marks the row as a link. onSelect decides how to open it.

children
CommandItem[]

Choosing the row opens these as a nested page instead of running it.

placeholder
string

Input placeholder while this item's page is open.

Dependencies

NeedsVersionComes from
lucide-react^0.556.0npm, installed by the CLI
motion^12.23.25npm, installed by the CLI
cn from lib/utils.tsshadcn init
React19Your app
Tailwind CSS4Your app

No provider, font or global CSS to set up: the file works as soon as it lands.