Navigated to /docs/ui/components/command-menu

CommandMenu

Command palette-style recipe for action discovery.

Preview

A live, theme-aware example rendered with the published component.

Loading preview…

Import

Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.

TSX
tsximport { CommandMenu } from "@tavojs/ui/command-menu";

Normal Tavo.js applications load component styles through the Tavo.js UI plugin. If the application manages component CSS manually, also import @tavojs/ui/css/command-menu.

When to use

Use it when

Use `CommandMenu` for command palette style action lists

Choose something else when

Avoid CommandMenu when when a low-level primitive would express a simpler one-off layout more clearly.

Examples

CommandMenu example

TSX
tsximport { CommandMenu } from "@tavojs/ui/command-menu";

export function CommandMenuExample1() {
  return (
    <>
      <CommandMenu items={[{ label: "Generate theme", shortcut: "G" }, { label: "Docs", href: "/docs" }]} />
    </>
  );
}

Common props and defaults

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
items{ label: string; description?: string; shortcut?: string; href?: string; disabled?: boolean; onSelect?: () => void }[]

Required

Configures items for this component.
placeholderstring

Configures placeholder for this component.

Complete TypeScript API

Import from @tavojs/ui/command-menu. Published exports: CommandMenu, CommandMenuItem, CommandMenuProps.

CommandMenuProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by CommandMenu.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by CommandMenu.

idstring

No

Inherited id attribute accepted by CommandMenu.

rolestring

No

Inherited role attribute accepted by CommandMenu.

styleRecord<string, unknown>

No

Inherited style attribute accepted by CommandMenu.

titlestring

No

Inherited title attribute accepted by CommandMenu.

tabIndexnumber

No

Inherited tabIndex attribute accepted by CommandMenu.

hiddenboolean

No

Inherited hidden attribute accepted by CommandMenu.

disabledboolean

No

Inherited disabled attribute accepted by CommandMenu.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by CommandMenu.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by CommandMenu.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by CommandMenu.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by CommandMenu.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by CommandMenu.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by CommandMenu.

itemsCommandMenuItem[]

Yes

Configures items for this component.

placeholderstring

No

Configures placeholder for this component.

State ownership and DOM target

ConcernContract
StateNo component state contract is exposed; the application owns the rendered content and surrounding behavior.
DOM targetPublic passthrough props target the component root. Treat nested elements and private class names as implementation details.

Anatomy and related components

This component exposes one public component root rather than a compound member API.

Limitations

Avoid CommandMenu when when a low-level primitive would express a simpler one-off layout more clearly.

Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.

Accessibility

Recipes compose lower-level components and inherit their labeling and keyboard expectations.

  • Keep recipe titles descriptive.

  • Use real controls in action slots.

  • Preserve list, table, or form semantics inside the composition.

Component status

ContractCurrent value
Maturitystable
Categoryrecipes
Component import@tavojs/ui/command-menu
Explicit CSS import@tavojs/ui/css/command-menu
PreviewInteractive preview available on this page