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.

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

Searchable dropdown

SearchableDropdown is a ready-made dropdown for picking one option from a list. Pass isSearchable to add a search field that filters options by label, give options a group to render them under section labels, and pass onReset (with buttonLabel) to append a reset action.

import { SearchableDropdown } from "@harnessio/ui/components";
<SearchableDropdown
isSearchable
displayLabel={<Button variant="outline">Select branch</Button>}
options={[{ label: "main", value: "main" }]}
onChange={(option) => setBranch(option.value)}
/>;

Installation

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