Skip to content

CommandMenu

1 field over every action. Type, arrow, Enter.

Installation

Install CommandMenu from the Fluid Effect UI registry.

Playground

Select↑↓Tabs←→Go to Calendar↵

Basic

Type to filter, use the arrow keys to move, and press Enter to run a command.

Descriptions, shortcuts, disabled rows

Arrow keys skip disabled rows. Type clipboard to match a command by keyword.

Suggestions

Recent commands appear first until you type. The remaining matches stay in their groups.

Tabs

Click a tab, or press the Left and Right arrow keys from the search field.

Filters

Group or sort results using the controls below the search field.

Dialog and trigger shortcut

Press ⌘P or Ctrl+P to open the first dialog. The second button has no shortcut. A choice or Escape closes either dialog.

Custom rows

Customize the row label while retaining native selection, icons, and shortcut caps.

API Reference

Types come from the public API. A dash indicates no default is documented here.

CommandMenu props

Public source
PropTypeDefaultDescription
keystring | undefined''The child's identity among its parent's children of one component. The empty string by default.
onEmit
Show type
((events: ComboboxEvents) => NoInfer<Msg> | undefined) | { readonly RequestedClose: (event: { readonly _tag: "RequestedClose"; readonly reason: "none" | "trigger-press" | "list-navigation" | "item-press" | "outside-press" | "escape-key" | "focus-out" | "close-press" | "cancel-open" | "input-press" | "input-change" | "input-clear" | "clear-press" | "chip-remove-press"; }) => NoInfer<Msg> | undefined; readonly RequestedOpen: (event: { readonly _tag: "RequestedOpen"; readonly reason: "none" | "trigger-press" | "list-navigation" | "item-press" | "outside-press" | "escape-key" | "focus-out" | "close-press" | "cancel-open" | "input-press" | "input-change" | "input-clear" | "clear-press" | "chip-remove-press"; }) => NoInfer<Msg> | undefined; readonly Picked: (event: { readonly _tag: "Picked"; readonly value: string | readonly string[] | null; readonly reason: "none" | "trigger-press" | "list-navigation" | "item-press" | "outside-press" | "escape-key" | "focus-out" | "close-press" | "cancel-open" | "input-press" | "input-change" | "input-clear" | "clear-press" | "chip-remove-press"; }) => NoInfer<Msg> | undefined; readonly Settled: (event: { readonly _tag: "Settled"; readonly open: boolean; }) => NoInfer<Msg> | undefined; readonly Highlighted: (event: { readonly _tag: "Highlighted"; readonly value: string | null; readonly index: number; readonly reason: "none" | "keyboard" | "pointer"; }) => NoInfer<Msg> | undefined; readonly RequestedInputValue: (event: { readonly _tag: "RequestedInputValue"; readonly inputValue: string; readonly reason: "none" | "trigger-press" | "list-navigation" | "item-press" | "outside-press" | "escape-key" | "focus-out" | "close-press" | "cancel-open" | "input-press" | "input-change" | "input-clear" | "clear-press" | "chip-remove-press"; }) => NoInfer<Msg> | undefined; } | undefined
—Handle the child's events with a callback, or supply one handler per tag for tagged events. Return a parent message to dispatch it, or `undefined` to ignore the event.
props.idstringRequired
props.itemsreadonly CommandMenuItem[]Required
props.querystringRequired
props.suggestionsreadonly string[]—
props.suggestionsLabelstring—
ariaLabelstringRequired
sizeSizeVariant'default'
shapeShapeVariant'rounded'
classNamestring—
placeholderstring'Type a command or search…'
emptyTextstring'No results found.'
reducedMotion"user" | "always" | "never"'user'
filter(item: CommandMenuItem, query: string) => boolean—
headerView.Input<Msg, R>—
tabs
Show type
{ readonly value: string; readonly items: ReadonlyArray<{ readonly value: string; readonly label: string; }>; readonly onSelected: (value: string) => NoInfer<Msg>; }
—
macbooleanfalse
footerView.Input<Msg, R> | ((activeItem: CommandMenuItem | undefined) => View.Input<Msg, R>)—
renderIcon(item: CommandMenuItem) => View.Content<Msg, R>—
renderItemLabel(item: CommandMenuItem) => View.Content<Msg, R>—
CommandMenuDialog
Public source
PropTypeDefaultDescription
keystring | undefined''The child's identity among its parent's children of one component. The empty string by default.
onEmit
Show type
((events: { readonly _tag: "RequestedClose"; readonly reason: "trigger-press" | "outside-press" | "escape-key" | "focus-out" | "close-press" | "close-watcher"; } | { readonly _tag: "RequestedOpen"; readonly triggerId: string | null; } | { readonly _tag: "Settled"; readonly open: boolean; }) => NoInfer<Msg> | undefined) | { readonly RequestedClose: (event: { readonly _tag: "RequestedClose"; readonly reason: "trigger-press" | "outside-press" | "escape-key" | "focus-out" | "close-press" | "close-watcher"; }) => NoInfer<Msg> | undefined; readonly RequestedOpen: (event: { readonly _tag: "RequestedOpen"; readonly triggerId: string | null; }) => NoInfer<Msg> | undefined; readonly Settled: (event: { readonly _tag: "Settled"; readonly open: boolean; }) => NoInfer<Msg> | undefined; } | undefined
—Handle the child's events with a callback, or supply one handler per tag for tagged events. Return a parent message to dispatch it, or `undefined` to ignore the event.
props.openbooleanRequired
props.idstring | undefined—
props.modalboolean | "trap-focus" | undefined—
props.topLayerboolean | undefined—
props.finalFocusboolean | undefined—
props.holdExitboolean | undefined—
props.triggerIdstring | null | undefined—
props.openMethod"touch" | "keyboard" | "mouse" | "pen" | null | undefined—
props.keepMountedboolean | undefined—
props.disablePointerDismissalboolean | undefined—
props.forceRenderBackdropboolean | undefined—
props.nestedboolean | undefined—
props.initialFocusboolean | undefined—
shortcutstring | null(options.shortcut === null ? '' : 'mod+k')
shortcutScopeIdstring''
onShortcut(open: boolean) => Msg—
titlestringRequired
descriptionstring'Search for a command to run.'
triggerView.Input<Msg, R>—
triggerButtonOmit<ButtonProps<Msg, R>, "onPress">—
menuCommandMenuOptions<Msg, R>Required
panelClassNamestring—