Skip to content
Playground

Command

A searchable command palette for actions and destinations.

A searchable command palette for actions and destinations. Arrow keys move the highlight, Enter runs the active row, and focus stays in the search field.

Backed by Base UI Combobox and Dialog for filtering, keyboard navigation, and the modal shell. Zenos owns the public API, styling, and composition shown on this page.

Last run: None

TSX
import { Command } from "@zentara-co/zenos-ui";

Command is the inline palette. Command.Dialog renders that same palette in a modal. Pass items as a flat list or as groups, and render the filtered rows from Command.List.

TSX
<Command label="Quick actions" items={actions}>  <Command.Input placeholder="Search actions" />  <Command.List>    {(action) => (      <Command.Item key={action.value} value={action.value} onSelect={action.run}>        {action.label}      </Command.Item>    )}  </Command.List>  <Command.Empty>No results found.</Command.Empty></Command>

Each row’s searchable identity is its value. Add keywords on the item for synonyms. A row that does not match is removed, and a group with no remaining rows is removed with it. Disabled rows stay visible and drop out of keyboard navigation.

Use Command directly to embed the palette in a page. It brings its own surface. Pass icon on Command.Item for a leading glyph. The shortcut hint on the search row is decorative.

New project
Invite teammate
Dashboard
Account
SupportOffline

Highlight with the arrow keys and run with Enter. Last run: None

The search field keeps focus. The active row is announced through aria-activedescendant. Arrow keys move the highlight, Enter runs the highlighted row, and the query stays as typed. Inside Command.Dialog, Escape closes the dialog. The Esc hint in the search row closes it too.

Open the dialog from a key binding in the application that owns the palette. ⌘K and Ctrl+K are the usual pair. The component does not listen for that shortcut itself.

TSX
useEffect(() => {  function onKeyDown(event: KeyboardEvent) {    if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") {      event.preventDefault();      setOpen((open) => !open);    }  }  document.addEventListener("keydown", onKeyDown);  return () => document.removeEventListener("keydown", onKeyDown);}, []);

density="comfortable | compact" inherits the nearest DensityProvider. Compact tightens the search row and the action rows. Color and radius stay the same.

comfortable

New project
Invite teammate

compact

New project
Invite teammate

Use Command for an open-ended, searchable list of actions or destinations. Use Combobox or Select when the person is choosing a value for a field. Use Dropdown Menu for a short fixed set of actions.

Command.Root
Command.Input
Command.List
Command.Empty
Command.Group
Command.GroupLabel
Command.Item
Command.Separator
Command.Shortcut
Command.Dialog

API

PropTypeDefaultDescription
items Item[] | { items: Item[]; label?: string }[] — Flat rows or groups. A row is a string or { value, label, keywords, disabled }.
label string — Accessible name for the search field and the result list.
search / defaultSearch / onSearchChange string / string / (search: string) => void — The query, controlled or uncontrolled.
filter (item, query) => boolean | null — Return false to hide a row. Null shows every row. The default match includes label, value, and keywords.
onSelect (value: string) => void — Runs after the chosen row's own onSelect.
Item.onSelect (value: string) => void — Runs when that row is chosen with the pointer or Enter.
Item.icon ReactNode — Leading icon for the row. The label stays in the children.
density comfortable | compact comfortable Controls the search row and item padding. Inherits from DensityProvider when omitted.
Dialog.open / defaultOpen / onOpenChange boolean / boolean / (open: boolean) => void — Dialog open state.
Dialog.closeOnSelect boolean true Closes the dialog after a row is chosen.
Dialog.title / description string — Visually hidden names for the dialog.
className string — Merged last on every part.
native props React.HTMLAttributes<HTMLDivElement> — Forwards native attributes, events, aria-*, data-*, className, style, and ref.

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

label names the search field and the result list. Give the dialog its own title and description; both are visually hidden. Keep empty-state text meaningful, and name each group with heading or Command.GroupLabel so arrow keys can move through its rows.