Skip to content
Will Breitkreutz edited this page Feb 1, 2024 · 3 revisions

component Search </>

Search is a cross between a "tool" and a "base component", but since it doesn't do anything until you wire up your own search logic, I've added it in the Components section.

Use Search to allow a user to query basically anything, the component handles user input, calling a search function, and rendering results in a list. You provide the actual smarts.

import { Search } from @usace/groundwork-geo;

Props

Name Type Default Description
value string "" The text value of the search input. Should update using the onChange handler.
results [object] [] Array of results to render. Each result should have the keys id and either _text or place_name in order for the results array to render correctly.
onChange function undefined Function fired as the user types into the input, will receive the string value of the input rather than the DOM event as you would expect from a typical <input/>
onSelect function undefined Function fired when a user selects a result item, will receive the result item object as the first argument.
onClear function undefined Function fired either after a user selects a result, the user presses ESC in the search input.

Clone this wiki locally