Skip to content

Command

Keyboard-first command palette / filterable menu. Compound API with case-insensitive substring filter, groups, and full a11y (combobox/listbox/option).

Overlays & Feedback·Available inReactVueAngular·View as Markdown

Preview

tsx
No results.
Suggestions
Settings

Switch the framework picker (top-right of the panel) to render the same demo live in React, Vue, or Angular — same class names, ARIA, and visual output across all three.

Installation

Sisyphos UI ships unified packages for React, Vue, and Angular. Pick the one that matches your stack — every framework exports the same component classes, ARIA semantics, and CSS tokens.

$ pnpm add @sisyphos-ui/react

Then import the bundled stylesheet once at app entry: import "@sisyphos-ui/react/styles.css";

Usage

Idiomatic usage in each supported framework
import { Command } from "@sisyphos-ui/react";

export const Palette = () => (
  <Command label="Command menu">
    <Command.Input placeholder="Type a command…" />
    <Command.List>
      <Command.Empty>No results.</Command.Empty>
      <Command.Group heading="Suggestions">
        <Command.Item value="new-file" onSelect={() => {}}>New file</Command.Item>
        <Command.Item value="open-recent" onSelect={() => {}}>Open recent…</Command.Item>
      </Command.Group>
    </Command.List>
  </Command>
);

Anatomy

The Command is a compound component. Compose the parts that match your use case.

Anatomy
<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.

tsx

With shortcuts

Drop a `<Kbd>` inside each `<Command.Item>` — it flows to the right automatically via `margin-left: auto` on the flex row.

tsx
File

Disabled items

`disabled` items are still rendered but don't match, aren't focusable, and can't be activated.

tsx

API

PropTypeDefaultDescription
valuestringControlled search value. Omit to let the component manage its own state.
defaultValuestring""Initial search value when uncontrolled.
onValueChange(value: string) => voidFires whenever the search value changes.
onSelect(value: string) => voidFires when an item is activated (click or Enter). Receives the item's `value` prop.
labelstring"Command menu"Accessible name for the combobox root.

The full API including refs, ARIA attributes, and HTML passthroughs lives in the package README on npm.

Accessibility

Adheres to the Combobox WAI-ARIA design pattern.

Keyboard interactions

KeyAction
ArrowDownthenArrowUpMove the active item (wraps at the edges).
HomethenEndFirst / last matching item.
EnterActivate the current item.
Need more?View on npm →
Was this page helpful?