QueryInput()function

QueryInput({
	empty = "No results",
	value,
	onValue,
	onQuery,
	formatter = formatValue,
	...props
}: QueryInputProps<I, O>): ReactElement
ParamType
propsQueryInputProps<I, O>
Props for QueryInput, a combo box that queries items of type O from an input of type I. required
    .schemaSchema<I>
Schema input required
    .onQueryPayloadFetchCallback<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.
    .emptyReactNode
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.

  • Shows an input based on a schema of type I; its values are piped to the onQuery() callback.
  • Shows a <Popover> with a radio list of returned items to pick a final value of type O.
  • Errors, loading, and empty states are handled automatically.

Examples

<QueryInput schema={SEARCH} onQuery={search} value={user} onValue={setUser} />