Laravel Community Tools by Tighten
Laravel Nova icon Nova Packages
T

Text Auto Complete

Installation Instructions

composer require lhilton/text-auto-complete

In your Nova Resource fields function:

use Lhilton\TextAutoComplete\TextAutoComplete;

public function fields(Request $request)
{
    return [
        Lhilton\TextAutoComplete\TextAutoComplete::make('Regions')->items(['one', 'two', 'sea', 'bar'])
    ];
}

Readme

laravel-nova-text-auto-complete

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.

Demo

Text Auto Complete

Installation

From the command line:

composer require lhilton/text-auto-complete

Usage

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();
        ),
    ];
}

Screenshots

Back to Top
Added 5 years ago
Last updated 5 Years Ago
Version v1.0.1
Composer
lhilton/text-auto-complete
GitHub stars 2
Packagist downloads 3,813

Favorites

4 users favorited

Rating

4.00
(out of 5)
★★★★★
★★★★
★★★
★★
1 ratings

Brought to you by Tighten

Issues/Feature Requests Stats Package Ideas