Skip to content
SENVENLI UI

Command

A ⌘K search over actions and records, with recent items, groups and server results.
Actions and pages
import { Command } from "@senvenli/react/overlay";

Examples

With ⌘K and recent items

The shortcut prop binds ⌘K (Ctrl K elsewhere); recent records show while the query is empty.

Guidelines

When to use it

  • An app with many pages and actions people want to reach by typing.

Use something else when

  • People pick a value for a field, not an action or a record. Combo box
  • A short fixed list of actions under a button. Menu

Accessibility

Keyboard

KeysWhat happens
Ctrl K / ⌘KOpens and closes it when bound.
Arrow keys, EnterMoves and runs the focused item.

Built in

  • Matching ignores case and accents.
  • Announces "No results".

You provide

  • Group names and item labels.

API reference

Command

isOpen
boolean
defaultOpen
boolean
onOpenChange
(isOpen: boolean) => void
groupsRequired
readonly CommandGroup[]

Actions and pages, most used first; matched here, diacritic-insensitive.

search
(query: string, signal: AbortSignal) => Promise<readonly CommandGroup[]>

Records found by the server (codes, order numbers, names, phones); shown before the groups.

recent
readonly CommandItem[]Default []

Shown while the query is empty, above the five most used actions.

onSelectRequired
(item: CommandItem) => void
shortcut
boolean

Bind ⌘K / Ctrl K to open and close it.