Skip to content
Uxelith
Sign in
Prov1.0.0Navigation

Command Palette

A ⌘K command menu with ranked fuzzy search and match highlighting. Give it a trigger and the search button grows into the palette and shrinks back on close. Inline or in a dialog.

Installs with Uxelith ProHow
Licence
Pro
Packages
3
Updated
9 Oct 2026
Live

Installation

Usage

example.tsx
"use client"

import { useRouter } from "next/navigation"

import { CommandPalette } from "@/components/command-palette"

export function AppCommands() {
  const router = useRouter()
  return (
    <CommandPalette
      groups={[
        {
          heading: "Navigation",
          items: [
            { id: "dashboard", label: "Go to dashboard", shortcut: ["G", "D"], onSelect: () => router.push("/dashboard") },
            { id: "billing", label: "Go to billing", keywords: ["invoice", "plan"], onSelect: () => router.push("/billing") },
          ],
        },
      ]}
    />
  )
}

Props

PropTypeDefaultDescription
groups{ heading: string; items: CommandItem[] }[]—Sections of the menu. Items have id, label, and optional keywords, shortcut, icon, disabled and onSelect.
hotkeystring | false"mod+k"Shortcut that toggles the palette. mod is ⌘ on Mac and Ctrl elsewhere; add shift or alt, e.g. "mod+shift+p".
triggerReactNode—Render a search button with this text; it morphs into the palette and back.
triggerClassNamestring—Classes for the trigger button.
open / defaultOpen / onOpenChangeboolean / boolean / (open) => void— / false / —Control the palette yourself, or let it manage its own state.
onSelect(item: CommandItem) => void—Called with the chosen item after its own onSelect. The palette then closes.
placeholderstring"Type a command or search…"Placeholder of the search field.
labelstring"Search commands"Accessible name of the search field and results list.
emptyMessageReactNode"No results found."Shown when nothing matches.
hintsbooleantrueShow the keyboard hints row.
CommandMenucomponent—The same searchable list without the dialog, for popovers, sidebars and pages.

Accessibility

  • WAI-ARIA combobox with a listbox: focus stays in the search field and the active option is announced through aria-activedescendant.
  • ↑ and ↓ move through enabled results and wrap; Enter runs the active one; disabled items are skipped and marked aria-disabled.
  • Groups are labelled by their headings, and the number of results is announced politely as you type.
  • Built on the native <dialog>: focus is trapped while open, Escape or a click outside closes it, and focus returns to where it was.
  • Under prefers-reduced-motion the dialog and the highlight change instantly.
  • The trigger is a button with aria-haspopup="dialog" and aria-expanded; the morph is replaced by a plain fade under prefers-reduced-motion.
  • The highlight jumps instantly while you arrow through results and glides only after the pointer.

Changelog

  1. v1.0.0Latest

    First release.

More in Navigation

All 6 in Navigation
  • NavigationFree

    Accordion

    Questions that spring open to their answers — reversible mid-way — with a hover highlight that glides between titles and a plus that folds into a minus (or a chevron). Single or multiple open, two looks.

  • NavigationFree

    Animated Tabs

    Tabs with an indicator that springs to the selected tab, a hover highlight that follows the pointer, and panels that slide in from the side you're heading to while the height eases to fit. Pill or underline.

  • NavigationFree

    Dock

    A macOS-style dock: icons swell up to 2× under the pointer or keyboard focus, labels spring in, and apps hop when launched.