Getting Started
Foundations
Components
Search for a command to run...
Command menus provide a keyboard-first interface for users to quickly search and execute commands, navigate to different sections, or access functionality without leaving the keyboard. They typically appear as a searchable list of actions, often triggered by keyboard shortcuts, and filter results as users type. Command menus are particularly popular in modern applications as they improve efficiency for power users and reduce the cognitive load of navigating complex menu hierarchies.
Use command menus to provide quick access to frequently used actions, global navigation, or search functionality. They're most effective in applications with many features where keyboard shortcuts and fast navigation are valuable to users. Command menus should include clear, descriptive labels for each command and optionally display keyboard shortcuts to help users learn efficient workflows.
import { Command } from "@strongtie/design-system/command"This module exports the following components:
CommandCommandDialogCommandInputCommandListCommandEmptyCommandGroupCommandItemCommandShortcutCommandSeparator<Command>| Prop | Type | Default | Description |
|---|---|---|---|
disablePointerSelection | boolean | - | Optionally set to true to disable selection via pointer events. |
filter | CommandFilter | - | Custom filter function for whether each command menu item should matches the given search query. It should return a number between 0 and 1, with 1 being the best match and 0 being hidden entirely. By default, uses the command-score library. |
label | string | - | Accessible label for this command menu. Not shown visibly. |
loop | boolean | - | Optionally set to true to turn on looping around when using the arrow keys. |
onValueChange | ((value: string) => void) | - | Event handler called when the selected item of the menu changes. |
shouldFilter | boolean | - | Optionally set to false to turn off the automatic filtering and sorting. If false, you must conditionally render valid items based on the search query yourself. |
value | string | - | Optional controlled state of the selected command menu item. |
vimBindings | boolean | - | Set to false to disable ctrl+n/j/p/k shortcuts. Defaults to true. |
<CommandDialog>| Prop | Type | Default | Description |
|---|---|---|---|
description | string | - | |
showCloseButton | boolean | - | |
title | string | - |
<CommandInput>| Prop | Type | Default | Description |
|---|---|---|---|
onValueChange | ((search: string) => void) | - | Event handler called when the search value changes. |
value | string | - | Optional controlled state for the value of the search input. |
<CommandList>| Prop | Type | Default | Description |
|---|---|---|---|
label | string | - | Accessible label for this List of suggestions. Not shown visibly. |
<CommandGroup>| Prop | Type | Default | Description |
|---|---|---|---|
forceMount | boolean | - | Whether this group is forcibly rendered regardless of filtering. |
heading | ReactNode | - | Optional heading to render for this group. |
value | string | - | If no heading is provided, you must provide a value that is unique for this group. |
<CommandItem>| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | - | Whether this item is currently disabled. |
forceMount | boolean | - | Whether this item is forcibly rendered regardless of filtering. |
keywords | string[] | - | Optional keywords to match against when filtering. |
onSelect | ((value: string) => void) | - | Event handler for when this item is selected, either via click or keyboard selection. |
value | string | - | A unique value for this item. If no value is provided, it will be inferred from children or the rendered textContent. If your textContent changes between renders, you must provide a stable, unique value. |
<CommandSeparator>| Prop | Type | Default | Description |
|---|---|---|---|
alwaysRender | boolean | - | Whether this separator should always be rendered. Useful if you disable automatic filtering. |
Press ⌘K
Search for a command to run...
Components can be styled using the className prop. The design system uses Tailwind CSS for styling.
CSS classes used by this component:
commandcommand-dialogcommand-emptycommand-groupcommand-inputcommand-itemcommand-listcommand-separatorcommand-shortcutEnsure proper accessibility attributes are added when implementing this component.