Search documentation

Find a component or a docs page

Command

Fast, composable command menu for Phlex.

Usage

Inline

Command works on the page too. Typing filters the items, the first match is active, the arrow keys, Home and End move through them and Enter selects. CommandSeparator hides while searching.

Dialog

CommandDialog opens the Command in a modal dialog from its trigger, and with ⌘K / Ctrl+K by default. This site's search already takes ⌘K, so the example turns the shortcut off with keybindings: []. title: and description: name the dialog for screen readers and are visually hidden. show_close_button: true adds the Dialog close button; it is off by default, as in shadcn, because it sits over the search field.

With shortcuts

CommandShortcut shows a keyboard hint at the end of an item.

Handling selection

Selecting an item dispatches a cancelable ruby-ui--command:select event with the item's value and href in its detail. Listen to it from your own Stimulus controller; call preventDefault() to skip the href visit.

Scrollable

CommandList scrolls past 18rem; the active item stays in view.

Installation

Components

ComponentBuilt usingSource
CommandPhlex
CommandDialogPhlex
CommandDialogContentPhlex
CommandDialogTriggerPhlex
CommandDocsPhlex
CommandEmptyPhlex
CommandGroupPhlex
CommandInputPhlex
CommandItemPhlex
CommandListPhlex
CommandSeparatorPhlex
CommandShortcutPhlex
CommandControllerStimulus JS