Skip to main content

Search

Properties

NameTypeDescription
ruleSearchRuleDefinition | undefinedThe active search rule set by this instance's ruleset.
searchTermstringThe user's search query, or an empty string.
hasSearchTermbooleanTrue if searchTerm is not an empty string.
hasSearchRulebooleanTrue if the ruleset provides a valid SearchRule.

Methods

reset

Resets search term state to an empty string.

finder.search.reset(): void;

setSearchTerm

finder.search.setSearchTerm(searchTerm:string): void;

test

Evaluate which items would match this search term without committing the change to state.

finder.search.test(searchTerm:string, isAdditive:boolean): FItem[];

Example Usage

function Search() {
const finder = useFinder();
return (
<>
<input
type="text"
value={finder.search.searchTerm}
onInput={(e) => finder.search.setSearchTerm(e.currentTarget.value)}
/>
<button
type="button"
onClick={() => finder.search.reset()}
>
Clear
</button>
</>
)
}