l2logic2b/ui

Command

Fast, composable command menu for React.

Installation

npx logic2b@latest add command

Usage

import {
  Command,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
} from "@/components/ui/command"

<Command>
  <CommandInput placeholder="Type a command or search..." />
  <CommandList>
    <CommandEmpty>No results found.</CommandEmpty>
    <CommandGroup heading="Suggestions">
      <CommandItem>Calendar</CommandItem>
    </CommandGroup>
  </CommandList>
</Command>

CommandDialog

Use CommandDialog to render the command menu inside a modal (cmd+k style). It depends on the dialog component.

import { CommandDialog, CommandInput, CommandList } from "@/components/ui/command"

<CommandDialog open={open} onOpenChange={setOpen}>
  <CommandInput placeholder="Type a command or search..." />
  <CommandList>...</CommandList>
</CommandDialog>