Command
Keyboard-first command palette / filterable menu. Compound API with case-insensitive substring filter, groups, and full a11y (combobox/listbox/option).
Preview
Installation
Install the individual package:
$ pnpm add @sisyphos-ui/command @sisyphos-ui/coreOr use the umbrella package that bundles everything:
$ pnpm add @sisyphos-ui/uiUsage
Import the component styles and the component itself:
import "@sisyphos-ui/command/styles.css";
import { Command } from "@sisyphos-ui/command";Anatomy
The Command is a compound component. Compose the parts that match your use case.
<Command.Root>
<Command.Input />// Text input that drives the filter.required
<Command.List />// Scrollable listbox region.required
<Command.Empty />// Rendered when no items match.
<Command.Group />// Optional section with an `heading`.
<Command.Item />// Selectable row filtered by `value`.required
<Command.Separator />// Visual divider.
</Command.Root>Inside a Dialog
The classic ⌘K experience — drop `<Command>` inside `<Dialog>` and the input takes focus on open.
With shortcuts
Drop a `<Kbd>` inside each `<Command.Item>` — it flows to the right automatically via `margin-left: auto` on the flex row.
Disabled items
`disabled` items are still rendered but don't match, aren't focusable, and can't be activated.
API
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | — | Controlled search value. Omit to let the component manage its own state. |
| defaultValue | string | "" | Initial search value when uncontrolled. |
| onValueChange | (value: string) => void | — | Fires whenever the search value changes. |
| onSelect | (value: string) => void | — | Fires when an item is activated (click or Enter). Receives the item's `value` prop. |
| label | string | "Command menu" | Accessible name for the combobox root. |
The full API including refs, ARIA attributes, and HTML passthroughs lives in the package README.
Accessibility
Adheres to the Combobox WAI-ARIA design pattern.
Keyboard interactions
| Key | Action |
|---|---|
| ArrowDownthenArrowUp | Move the active item (wraps at the edges). |
| HomethenEnd | First / last matching item. |
| Enter | Activate the current item. |