Skip to Content
ComponentsInputSearchInput

SearchInput

Search box. onChange reports the text; onSearch fires on Enter or the search button. enterButton adds the button: true for an icon, a string for a labelled button, or any node. redirectTo navigates on search with the query appended (?q=… by default).

import { SearchInput } from '@gg-software/ui'; <SearchInput placeholder="Search…" onSearch={(q) => runSearch(q)} /> <SearchInput placeholder="Search products" enterButton="Search" /> // navigate to /search?q=<query> on submit <SearchInput redirectTo="/search" queryParam="q" />

Props

PropTypeDefaultDescription
childrenReactNodecontent rendered inside the component
status"warning" | "error"validation state styling
stepstring | number1amount added/removed per step or arrow key (default 1)
size"sm" | "md" | "lg"md
maxstring | number
minstring | number
valuestring
defaultValuestring
onChange((value: string) => void)text change
onSearch((value: string) => void)fired on Enter or when the search action is triggered
enterButtonReactNode`true` = icon button, string = labelled button, node = custom button content
loadingbooleanfalse
clearablebooleantrue
redirectTostringnavigate here on search, appending the query as `?<queryParam>=<value>`
queryParamstringq

* required · generated from packages/ui/src/input/SearchInput/SearchInput.tsx