Installation
$ pnpm dlx shadcn@latest add @synccn/commandFirst time in this project? Connect synccn with one command.
Usage
import { Command } from "@/components/ui/command";<Command groups={groups} />API reference
Generated from the component's TypeScript types, so it always matches the code.
Command
Searchable command list with groups and keyboard navigation. groups: [{ heading, items: [{ id, label, icon?, shortcut?, keywords?, onSelect }] }]
- groupsrequired
CommandGroup[]Grouped items to search.
- placeholder
stringDefault
"Type a command or search…"Search field placeholder.
- empty
React.ReactNodeDefault
"No results. Try another search."Shown when nothing matches.
- autoFocus
booleanDefault
trueFocus the search field on mount.
- onSelect
(item: CommandItem) => voidCalled after any item runs.
- footer
React.ReactNodeContent below the list, e.g. keyboard hints.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
- lib/utilscn (merges class names)
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for Search
Used by
Keyboard
- ↓or↑Move through results (wraps around)
- EnterRun the highlighted command
Accessibility
- Results are a listbox grouped by heading; matching is fuzzy and ranks by score.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: group, listbox, option
- ARIA attributes: aria-label, aria-selected
- Keys handled: ArrowUp, ArrowDown, Enter