Fidely UI v1 beta is now available!. 🚀

Command Input

An input-like trigger used to open command palettes or search dialogs, supporting icons, keyboard shortcuts, and custom placeholders

Usage

import { CommandInput } from '@fidely-ui/react'
<CommandInput onOpen={() => console.log('Open command palette')} />

The CommandInput component acts as a trigger for opening a command palette or search dialog. It supports keyboard shortcuts, icons, and custom placeholder text.

With Custom Icon

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

Responsive Behavior

On mobile devices, the keyboard shortcut display is automatically hidden to ensure a clean UI.

When the user presses the defined shortcut, the onOpen callback is automatically triggered (except on mobile devices).

Accessibility

The CommandInput uses a semantic button role with aria-haspopup="dialog" for accessibility, making it discoverable by assistive technologies as a command or dialog trigger.

Props

CommandInput

PropTypeDefaultDescription
placeholderstring"Search or type a command..."Text displayed when the input is empty.
shortcutstring"⌘K" (Mac) / "Ctrl+K" (Windows)Keyboard shortcut to trigger the command palette.
onOpen() => void—Callback invoked when the input or shortcut triggers the command palette.
leftElementReactNode<SearchIcon />Optional icon displayed inside the input trigger.