Search input



Match with result count

Match with navigable options

With submit button

Focus search input using ref

With expandable button


The search input component can be used to dynamically build a one to one attribute-value advanced search. Using the attributes prop alongside the advancedSearchDelimiter will expose this functionality, as demonstrated in the following example. The search input component can also be used as a composable component and paired with a Popper or other elements to build a completely custom advanced search form. This feature is demonstrated in the search input's react demos.

The values used in the attribute-value form fields may contain spaces. The values containing spaces should be wrapped with quotes inside the summary search string in the input field. If the latter is autogenerated from the individual fields the quotes will be autoplaced.



advancedSearchDelimiterstringDelimiter in the query string for pairing attributes with search values. Required whenever attributes are passed as props.
attributesstring[] | SearchInputSearchAttribute[][]Array of attribute values used for dynamically generated advanced search.
classNamestringAdditional classes added to the advanced search menu.
getAttrValueMap() => { [key: string]: string }Function which builds an attribute-value map by parsing the value in the search input.
hasWordsAttrLabelReact.ReactNode'Has words'Attribute label for strings unassociated with one of the provided listed attributes.
isSearchMenuOpenbooleanFlag for toggling the open/close state of the advanced search menu.
onChange(event: React.FormEvent<HTMLInputElement>, value: string) => voidA callback for when the input value changes.
onClear(event: React.SyntheticEvent<HTMLButtonElement>) => voidA callback for when the user clicks the clear button.
onSearch( event: React.SyntheticEvent<HTMLButtonElement>, value: string, attrValueMap: { [key: string]: string } ) => voidA callback for when the search button is clicked.
onToggleAdvancedMenu(e: React.SyntheticEvent<HTMLButtonElement>) => voidA callback for when the open advanced search button is clicked.
parentInputRefReact.RefObject<any>Ref of the input element within the search input.
parentRefReact.RefObject<any>Ref of the div wrapping the whole search input.
resetButtonLabelstring'Reset'Label for the button which resets the advanced search form and clears the search input.
submitSearchButtonLabelstring'Search'Label for the button which calls the onSearch event handler.
valuestring''Value of the search input.


Properties for adding search attributes to an advanced search input. These properties must be passed in as an object within an array to the search input component's attribute properrty.
attrrequiredstringThe search attribute's value to be provided in the search input's query string. It should have no spaces and be unique for every attribute.
displayrequiredReact.ReactNodeThe search attribute's display name. It is used to label the field in the advanced search menu.


Properties for creating an expandable search input. These properties should be passed into the search input component's expandableInput property.
isExpandedrequiredbooleanFlag to indicate if the search input is expanded.
onToggleExpandrequired(event: React.SyntheticEvent<HTMLButtonElement>, isExpanded: boolean) => voidCallback function to toggle the expandable search input.
toggleAriaLabelrequiredstringAn accessible label for the expandable search input toggle.

CSS variables


View source on GitHub