Unlock faster development with Fidely UI Pro components Coming soon

Command Input

A non editable, input like trigger for opening command palettes or search dialog. Supports icons, keyboard shortcuts, and custom placeholders

Overview

CommandInput is an input styled trigger used to open command palettes, dialogs, or search surfaces. It does not accept text input directly.

It is commonly used to:

  • Open command palettes (⌘K / Ctrl+K)

  • Trigger global search dialogs

  • Act as a combobox or dialog entry point

Usage

import { CommandInput } from '@fidely-ui/react'
<CommandInput />

When the user clicks the component or presses the configured keyboard shortcut, the onOpen callback is invoked.

With Custom Icon

You can replace the default search icon using the leftElement prop.

Use with Dialog & Combobox

CommandInput is typically paired with a dialog and combobox for search UI.

On desktop devices, pressing the configured keyboard shortcut automatically triggers onOpen.

On mobile devices, the shortcut hint is hidden and keyboard shortcuts are disabled.

Custom Keyboard Shortcut

You can override the default shortcut (⌘ + K on macOS or Ctrl + K on Windows) using the shortcut prop.

Responsive Behavior

  • Keyboard shortcut hints are hidden on mobile devices

  • Keyboard shortcuts only trigger onOpen on desktop

  • Tap or click interaction is always supported

Props

CommandInput

PropTypeDefaultDescription
placeholderstring"Search..."Placeholder text shown inside the input trigger..
shortcutstring"⌘K" (Mac) / "Ctrl+K" (Windows)Keyboard shortcut that triggers the command action.
onOpen() => voidCallback fired when the input or keyboard shortcut is activated.
isOpenbooleanfalseControls the active/open visual state of the trigger.
size'sm' | 'md' | 'lg'mdThe size of the CommandInput component
leftElementReactNode<SearchIcon />Element rendered at the start of the input trigger.
aria-labelstring-Optional. Overrides the accessible name of the button. Required only if visible text is removed or hidden.