bearnie

Command

A command menu for search and quick actions.

Suggestions
Calendar
Search
Calculator
Settings
Profile ⌘P
Billing ⌘B
Settings ⌘S

Installation

npx bearnie add command
npx bearnie add command

Usage

import {
  Command,
  CommandInput,
  CommandList,
  CommandEmpty,
  CommandGroup,
  CommandItem,
  CommandSeparator,
  CommandShortcut,
} from "@/components/bearnie/command"
<Command class="max-w-md rounded-lg border">
  <CommandInput placeholder="Search..." />
  <CommandList>
    <CommandEmpty>No results found.</CommandEmpty>
    <CommandGroup heading="Actions">
      <CommandItem>Action 1</CommandItem>
      <CommandItem>Action 2</CommandItem>
    </CommandGroup>
  </CommandList>
</Command>

Examples

Basic

Apple
Banana
Cherry
Orange
Strawberry

With groups

Fruits
Apple
Banana
Orange
Vegetables
Carrot
Broccoli
Spinach

Dialog

Keyboard navigation

  • Arrow Up/Down - Navigate between items
  • Enter - Select the focused item
  • Escape - Close dialog or blur input
  • Cmd/Ctrl + K - Open command dialog (when using CommandDialog)

Props

Command

Root container that manages filtering and keyboard navigation.

PropTypeDefaultDescription
classstring-Additional CSS classes

CommandInput

PropTypeDefaultDescription
placeholderstring”Search…”Input placeholder text

CommandGroup

PropTypeDefaultDescription
headingstring-Group heading text

CommandItem

PropTypeDefaultDescription
valuestring-Value returned on selection
disabledbooleanfalseDisable the item

CommandEmpty

Displayed when no items match the search query.

CommandSeparator

Visual divider between groups.

CommandShortcut

Displays keyboard shortcut hint, aligned to the right.