A Laravel Nova text field supporting autocomplete from an array of values.
lhilton/text-auto-complete is a Laravel package for a laravel nova text field supporting autocomplete from an array of values..
It currently has 2 GitHub stars and 4.088 downloads on Packagist (latest version v1.0.1).
Install it with composer require lhilton/text-auto-complete.
Discover more Laravel packages by lhilton
or browse all Laravel packages to compare alternatives.
Last updated
A Laravel Nova text field supporting autocomplete from an array of values. The field is a simple text field with the ability to provide autocompletion from an array of strings.
This does not force the selection of an item. The user will be free to type arbitrary text.

From the command line:
composer require lhilton/text-auto-complete
Provile an array of strings that you want to be shown during usage.
use Lhilton\TextAutoComplete\TextAutoComplete;
public function fields(Request $request)
{
return [
TextAutoComplete::make('Regions')->items([
'Alabama',
'Alaska',
'Arizona',
'Arkansas',
// ...
'West Virginia',
'Wisconsin',
'Wyoming'
]),
];
}
You can feed from an Eloquent model like this:
use App\Models\User;
use Lhilton\TextAutoComplete\TextAutoComplete;
public function fields(Request $request)
{
return [
TextAutoComplete::make('Regions')->items(
User::select('title')
->distinct()
->get()
->pluck('title')
->filter()
->values()
->toArray();
),
];
}