preskok/ui

A command palette component for searchable command lists.

Installation

pnpm dlx @preskok-org/ui@latest add command

Usage

import {
  Command,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
} from "@/registry/preskok/ui/preskok-ui/command"
 
export function CommandDemo() {
  return (
    <Command>
      <CommandInput placeholder="Type a command..." />
      <CommandList>
        <CommandEmpty>No results found.</CommandEmpty>
        <CommandGroup heading="Suggestions">
          <CommandItem>Calendar</CommandItem>
          <CommandItem>Search Emoji</CommandItem>
        </CommandGroup>
      </CommandList>
    </Command>
  )
}

Components

Command

The root command component that manages state and keyboard navigation.

CommandInput

Search input for filtering command items.

CommandList

Container for command groups and items.

CommandEmpty

Displayed when no results match the search query.

CommandGroup

Groups related command items together with an optional heading.

CommandItem

Individual selectable command option.

CommandSeparator

Visual separator between command groups.