Gutenberg Components: Autocomplete


The Gutenberg Component Autocomplete is an interesting one. You can use it to show a list of posts to choose from or any other list possible. In this tutorial we are going to learn the options for it and how it is used inside of Gutenberg. If you’re interested in a more advanced tutorial on this, you can watch one which I made using the Autocomplete.
Do note that this was done on an older Gutenberg version so some of it might not work although I did test it out recently.
The Gutenberg Component Autocomplete can be found on their github repository.
Autocomplete Properties
Autocomplete Component accepts completers which are objects defining their usage.
completers – Array of completers,
onReplace – Optional. A function that will be used if the used completer configuration has the property getOptionCompletion set and the action is set to replace,
record – Used for context.
Do note that record is causing issues as of 4.0.0 and this can be tracked at this Github issue.
I have overcome the issue by passing an empty record= to the Autocomplete component. Others have used RichText component with completers.
Completer Properties
There are several properties for each
Source: https://managewp.org/articles/18245/gutenberg-components-autocomplete



source https://williechiu40.wordpress.com/2018/12/29/gutenberg-components-autocomplete/