QueryInput()function
QueryInput({
empty = "No results",
value,
onValue,
onQuery,
formatter = formatValue,
...props
}: QueryInputProps<I, O>): ReactElement| Param | Type | |
|---|---|---|
props | QueryInputProps<I, O> | Props for QueryInput, a combo box that queries items of type O from an input of type I. required |
.schema | Schema<I> | Schema input required |
.onQuery | PayloadFetchCallback<I, ImmutableArray<O>undefined> | Called with the current text value to return matching items whenever the text input changes. - Automatically debounced, so only called after a short delay. - Automatically shows a loading state while loading. - Returning undefined signals to close the popover. required |
.formatter | ((value: O) => string) | Format an item of type O for display in the picker. |
.empty | ReactNode | Message that shows when query returns [] empty array (set to "" empty string to show no message). |
| Return | |
|---|---|
ReactElement | A combo box element wrapping the input and results popover. |
Combo box that queries a list of items and lets the user pick one from a popover.
Examples
<QueryInput schema={SEARCH} onQuery={search} value={user} onValue={setUser} />