Skip to content

Search Input

SearchInput is a text input tuned for search: a leading search icon, a built-in 300ms debounce so callbacks don’t fire on every keystroke, and optional match-navigation controls.

The example below tracks the current value with React state.

Variations

With navigation

Set showPrevNextButtons to add match-navigation controls. Previous, next, and clear buttons appear once there’s text in the field.

Navigation:

  • Click the ↑ button or press Shift+Enter to go to the previous result
  • Click the ↓ button or press Enter to go to the next result
  • Click the × button to clear the search
  • Click the ⌘F badge or press ⌘F (Mac) / Ctrl+F (Windows/Linux) to focus the search input

Installation

import { SearchInput } from '@harnessio/ui/components'
//...
return (
<SearchInput
placeholder="Type to search..."
onChange={(value) => setSearchValue(value)}
/>
)