Overview
Forms & inputs
Search for a command to run or a page to navigate to.
Command is a keyboard-accessible command menu component for quick access to actions and navigation.
import { Command } from "@strongtie/design-system/command"Not installed yet? Add the package to your app:
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...