Home / Function/ CommandItem() — ui Function Reference

CommandItem() — ui Function Reference

Architecture documentation for the CommandItem() function in command.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  a39153b4_13bd_73db_964f_3cd988dc9d91["CommandItem()"]
  191b7c88_cdb7_116e_59cb_2e77505bc304["command.tsx"]
  a39153b4_13bd_73db_964f_3cd988dc9d91 -->|defined in| 191b7c88_cdb7_116e_59cb_2e77505bc304
  style a39153b4_13bd_73db_964f_3cd988dc9d91 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/examples/base/ui/command.tsx lines 146–164

function CommandItem({
  className,
  children,
  ...props
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
  return (
    <CommandPrimitive.Item
      data-slot="command-item"
      className={cn(
        "data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
        className
      )}
      {...props}
    >
      {children}
      <CheckIcon className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
    </CommandPrimitive.Item>
  )
}

Subdomains

Frequently Asked Questions

What does CommandItem() do?
CommandItem() is a function in the ui codebase, defined in apps/v4/examples/base/ui/command.tsx.
Where is CommandItem() defined?
CommandItem() is defined in apps/v4/examples/base/ui/command.tsx at line 146.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free