Strongtie Design System
Getting StartedComponents

Command Palette

Search for a command to run...

Getting Started
  • Introduction
  • Setup Guide
  • Package Installation
  • Code Quality Setup
  • Migration Guide
  • Resources
Registry
  • Getting Started
  • Combobox
  • Datepicker
  • MultiSelect
  • Tree
Guides
  • Framework Recommendations
Foundations
  • States
  • Variables
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Avatar
  • Badge
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Collapsible
  • Command
  • Combobox
  • Context Menu
  • Date Picker
  • Dialog
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • Hover Card
  • Input
  • Input Group
  • Item
  • Kbd
  • Label
  • Menubar
  • Multi Select
  • Navigation Menu
  • Pagination
  • Popover
  • Progress
  • Radio Group
  • Scroll Area
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Switch
  • Table
  • Tabs
  • Textarea
  • Toaster
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
2026 Simpson Strong-Tie
  1. Docs
  2. Components
  3. Command

Command

PreviousNext

Command is a keyboard-accessible command menu component for quick access to actions and navigation.

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.

Example

No results found.
Calendar
Search Emoji
Calculator
Settings
Profile
"use client"

import {
  Command,
  CommandEmpty,
  CommandInput,
  CommandItem,
  CommandList,
} from "@strongtie/design-system/command"

export function CommandDefault() {
  return (
    <Command className="rounded-lg border shadow-md">
      <CommandInput placeholder="Type a command or search..." />
      <CommandList>
        <CommandEmpty>No results found.</CommandEmpty>
        <CommandItem>Calendar</CommandItem>
        <CommandItem>Search Emoji</CommandItem>
        <CommandItem>Calculator</CommandItem>
        <CommandItem>Settings</CommandItem>
        <CommandItem>Profile</CommandItem>
      </CommandList>
    </Command>
  )
}

Installation

npm install @strongtie/design-system
import { Command } from "@strongtie/design-system/command"

Components

This module exports the following components:

  • Command
  • CommandDialog
  • CommandInput
  • CommandList
  • CommandEmpty
  • CommandGroup
  • CommandItem
  • CommandShortcut
  • CommandSeparator

Props

<Command>

PropTypeDefaultDescription
disablePointerSelectionboolean-Optionally set to true to disable selection via pointer events.
filterCommandFilter-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.
labelstring-Accessible label for this command menu. Not shown visibly.
loopboolean-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.
shouldFilterboolean-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.
valuestring-Optional controlled state of the selected command menu item.
vimBindingsboolean-Set to false to disable ctrl+n/j/p/k shortcuts. Defaults to true.

<CommandDialog>

PropTypeDefaultDescription
descriptionstring-
showCloseButtonboolean-
titlestring-

<CommandInput>

PropTypeDefaultDescription
onValueChange((search: string) => void)-Event handler called when the search value changes.
valuestring-Optional controlled state for the value of the search input.

<CommandList>

PropTypeDefaultDescription
labelstring-Accessible label for this List of suggestions. Not shown visibly.

<CommandGroup>

PropTypeDefaultDescription
forceMountboolean-Whether this group is forcibly rendered regardless of filtering.
headingReactNode-Optional heading to render for this group.
valuestring-If no heading is provided, you must provide a value that is unique for this group.

<CommandItem>

PropTypeDefaultDescription
disabledboolean-Whether this item is currently disabled.
forceMountboolean-Whether this item is forcibly rendered regardless of filtering.
keywordsstring[]-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.
valuestring-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>

PropTypeDefaultDescription
alwaysRenderboolean-Whether this separator should always be rendered. Useful if you disable automatic filtering.

Examples

No results found.
Calendar
Search Emoji
Calculator
Settings
Profile
"use client"

import {
  Command,
  CommandEmpty,
  CommandInput,
  CommandItem,
  CommandList,
} from "@strongtie/design-system/command"

export function CommandDefault() {
  return (
    <Command className="rounded-lg border shadow-md">
      <CommandInput placeholder="Type a command or search..." />
      <CommandList>
        <CommandEmpty>No results found.</CommandEmpty>
        <CommandItem>Calendar</CommandItem>
        <CommandItem>Search Emoji</CommandItem>
        <CommandItem>Calculator</CommandItem>
        <CommandItem>Settings</CommandItem>
        <CommandItem>Profile</CommandItem>
      </CommandList>
    </Command>
  )
}

Dialog

Press ⌘K

Command Palette

Search for a command to run...

"use client"

import * as React from "react"
import { Button } from "@strongtie/design-system/button"
import {
  CommandDialog,
  CommandEmpty,
  CommandInput,
  CommandItem,
  CommandList,
} from "@strongtie/design-system/command"

export function CommandDialogExample() {
  const [open, setOpen] = React.useState(false)

  React.useEffect(() => {
    const down = (e: KeyboardEvent) => {
      if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
        e.preventDefault()
        setOpen((open) => !open)
      }
    }

    document.addEventListener("keydown", down)
    return () => document.removeEventListener("keydown", down)
  }, [])

  return (
    <>
      <Button variant="outline" onClick={() => setOpen(true)}>
        Open Command Menu
      </Button>
      <p className="text-muted-foreground mt-2 text-sm">
        Press{" "}
        <kbd className="bg-muted pointer-events-none inline-flex h-5 items-center gap-1 rounded border px-1.5 font-mono text-[10px] font-medium opacity-100 select-none">
          <span className="text-xs">⌘</span>K
        </kbd>
      </p>
      <CommandDialog open={open} onOpenChange={setOpen}>
        <CommandInput placeholder="Type a command or search..." />
        <CommandList>
          <CommandEmpty>No results found.</CommandEmpty>
          <CommandItem onSelect={() => setOpen(false)}>Calendar</CommandItem>
          <CommandItem onSelect={() => setOpen(false)}>
            Search Emoji
          </CommandItem>
          <CommandItem onSelect={() => setOpen(false)}>Calculator</CommandItem>
          <CommandItem onSelect={() => setOpen(false)}>Settings</CommandItem>
          <CommandItem onSelect={() => setOpen(false)}>Profile</CommandItem>
        </CommandList>
      </CommandDialog>
    </>
  )
}

With Groups

No results found.
Suggestions
Calendar
Search Emoji
Launch
Settings
Profile
Settings
Search
"use client"

import {
  CalendarIcon,
  FaceIcon,
  GearIcon,
  MagnifyingGlassIcon,
  PersonIcon,
  RocketIcon,
} from "@radix-ui/react-icons"
import {
  Command,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
  CommandSeparator,
} from "@strongtie/design-system/command"

export function CommandWithGroups() {
  return (
    <Command className="rounded-lg border shadow-md">
      <CommandInput placeholder="Type a command or search..." />
      <CommandList>
        <CommandEmpty>No results found.</CommandEmpty>
        <CommandGroup heading="Suggestions">
          <CommandItem>
            <CalendarIcon />
            Calendar
          </CommandItem>
          <CommandItem>
            <FaceIcon />
            Search Emoji
          </CommandItem>
          <CommandItem>
            <RocketIcon />
            Launch
          </CommandItem>
        </CommandGroup>
        <CommandSeparator />
        <CommandGroup heading="Settings">
          <CommandItem>
            <PersonIcon />
            Profile
          </CommandItem>
          <CommandItem>
            <GearIcon />
            Settings
          </CommandItem>
          <CommandItem>
            <MagnifyingGlassIcon />
            Search
          </CommandItem>
        </CommandGroup>
      </CommandList>
    </Command>
  )
}

With Shortcuts

No results found.
Suggestions
Calendar⌘C
Search Emoji⌘E
Launch⌘L
Settings
Profile⌘P
Settings⌘S
"use client"

import {
  CalendarIcon,
  FaceIcon,
  GearIcon,
  PersonIcon,
  RocketIcon,
} from "@radix-ui/react-icons"
import {
  Command,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
  CommandShortcut,
} from "@strongtie/design-system/command"

export function CommandWithShortcuts() {
  return (
    <Command className="rounded-lg border shadow-md">
      <CommandInput placeholder="Type a command or search..." />
      <CommandList>
        <CommandEmpty>No results found.</CommandEmpty>
        <CommandGroup heading="Suggestions">
          <CommandItem>
            <CalendarIcon />
            Calendar
            <CommandShortcut>⌘C</CommandShortcut>
          </CommandItem>
          <CommandItem>
            <FaceIcon />
            Search Emoji
            <CommandShortcut>⌘E</CommandShortcut>
          </CommandItem>
          <CommandItem>
            <RocketIcon />
            Launch
            <CommandShortcut>⌘L</CommandShortcut>
          </CommandItem>
        </CommandGroup>
        <CommandGroup heading="Settings">
          <CommandItem>
            <PersonIcon />
            Profile
            <CommandShortcut>⌘P</CommandShortcut>
          </CommandItem>
          <CommandItem>
            <GearIcon />
            Settings
            <CommandShortcut>⌘S</CommandShortcut>
          </CommandItem>
        </CommandGroup>
      </CommandList>
    </Command>
  )
}

Styling

Components can be styled using the className prop. The design system uses Tailwind CSS for styling.

Classes

CSS classes used by this component:

  • command
  • command-dialog
  • command-empty
  • command-group
  • command-input
  • command-item
  • command-list
  • command-separator
  • command-shortcut

Accessibility

Ensure proper accessibility attributes are added when implementing this component.

ComboboxContext Menu

On This Page

ExampleInstallationComponentsProps<Command><CommandDialog><CommandInput><CommandList><CommandGroup><CommandItem><CommandSeparator>ExamplesDialogWith GroupsWith ShortcutsStylingClassesAccessibility

Contribute

  • Report an issue
  • Request a feature
  • Edit this page