Skip to content

Does QueryBuilder allow the input field to be set as an autocomplete select input field ? #430

Discussion options

You must be logged in to vote

There are a few autocomplete components out there that you can use with this library. I generally use react-select, either the standard Select component or the Async component if I need to load options asynchronously from an API.

Here is an example of a custom ValueEditor that uses react-select when the field is "autocomplete" and falls back to the default ValueEditor. The list fakes a delay for an API call with setTimeout and then loads the options that match what the user has typed.

https://codesandbox.io/s/broken-snow-b78i8f?file=/src/MyValueEditor.tsx

import { ValueEditor, ValueEditorProps } from 'react-querybuilder';
import type { GroupBase, OptionsOrGroups } from 'react-select';
import

Replies: 1 comment 13 replies

Comment options

You must be logged in to vote
13 replies
@jakeboone02
Comment options

@keerthankrishna
Comment options

@jakeboone02
Comment options

@keerthankrishna
Comment options

@jakeboone02
Comment options

Answer selected by keerthankrishna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants